Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. We have updated the language to the Editor Terms based on feedback from our employees and community. Learn more.
    Dismiss Notice

AddForceAtPosition Confusion

Discussion in 'Physics' started by jdruzdzel, Mar 16, 2022.

  1. jdruzdzel

    jdruzdzel

    Joined:
    Jan 9, 2018
    Posts:
    8
    Hello,

    I am having a hard time understanding the results of a Rigidbody2D's call to AddForceAtPosition with varying position input. It's resulting sum of momentums (linear and rotational) depend on the given positional offset.

    No matter the given offset position, the body simply experiences a velocity change akin to an AddForce call (always gets this linear momentum delta).
    If a lever is formed by the given position to the body's center of mass, the body then *additionally* experiences a rotational velocity change akin to an AddTorque call (only angular momentum delta is variable).

    Shouldn't a body's call to AddForceAtPosition result in the same sum of change of linear momentum and angular momentum?
    I would assume the greater the lever, the more force is "dedicated" to applied torque, and so the body's velocity delta is reduced, but currently torque is supplementary, instead of being accommodated for.

    This is most probably expected behavior, but why? Isn't it physically inconsistent?

    I see AddForceAtPosition as an inelastic collision between the body and an infinitely small object going really fast. Is my understanding of physics even correct?

    AddForceAtPosition.gif
    Note that the script uses ForceMode2D.Impulse, however Force mode does the same.

    Cheers
     
  2. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,434
    Surprisingly, the result is physically correct. The force acts over a longer path in the second case than in the first. As a result, the force does more work and applies more kinetic energy to the cube.

    This paper explains this effect in the section 5.5 (page D28): https://www.cs.cmu.edu/~baraff/sigcourse/notesd1.pdf

    Here's the relevant part:

    upload_2022-3-16_21-5-32.png

    A practical example is the pool balls. Hitting the ball off-center gives it a spin additional to the actual linear impulse, which is the same regardless the hit point.
     
    MelvMay and jdruzdzel like this.
  3. jdruzdzel

    jdruzdzel

    Joined:
    Jan 9, 2018
    Posts:
    8
    Very interesting, thank you for a clear and sourced answer. I don't understand it fully just yet, but it's good to know I'm wrong. So, the short answer is, the greater the lever, the more the force can be 'absorbed' by the body?

    Your pool ball example is still confusing to imagine because off-center collisions result in a different trajectory, but I'll just assume the cue ball is launched at the same speed, and the target ball is sent off with consistent resulting speeds (albiet with varying rotation :) )
     
  4. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,434
    The greater the lever, the more distance is traveled by the force. Force over distance = work = energy. Therefore, the same force "transmits" an additional energy to the body in the form of angular velocity.
    I meant when hitting the cue ball with the cue stick. The cue ball is sent off with the same speed and direction regardless being hit off-center or not.
     
    jdruzdzel likes this.
  5. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    10,623
    jdruzdzel and Edy like this.