Search Unity

  1. Unity 2019.2 is now released.
    Dismiss Notice

Documentation is confusing

Discussion in 'Documentation' started by Vasile-Peste, Jul 30, 2019.

  1. Vasile-Peste

    Vasile-Peste

    Joined:
    Jul 23, 2018
    Posts:
    4
    Hello,
    I am Vasile Pește. I was writing a post on how to get the impact force of a collision in Unity and while reading the documentation I found something strange.

    To understand you should also read my post: https://www.malgol.com/how-to-get-the-impact-force-of-a-collision-in-unity/

    1. To detect the collision impact force of a 3D collision we can use the "impulse" property of the Collision class and divide it by Time.fixedDeltaTime
    https://docs.unity3d.com/ScriptReference/Collision-impulse.html
    as your documentation says: "To work out the total force applied you can divide the total impulse by the last frame's fixedDeltaTime."

    2. To detect the collision impact force of a 2D collision we can't simply call a "impulse" property since it is not defined in the Collision2D class. So we have to sum the impulse of all the contact points of the collision.

    So as you can see in my article we have to get all the contact points of the Collision2D instance and sum this:
    https://docs.unity3d.com/ScriptReference/ContactPoint2D-normalImpulse.html

    The problem is right there:
    In your documentation about the ContactPoint2D.normalImpulse you don't call it impulse, you call it "impulse force" which I think is wrong and ambigous in Physics (https://www.physicsclassroom.com/class/momentum/Lesson-1/Momentum-and-Impulse-Connection). Force and Impulse are two different things.

    It is not clear if you are calling it "impulse force" because you have already divided it by Time.fixedDeltaTime or not. It is not clear for me if I have to divide it by Time.fixedDeltaTime.
    Starting from the impulse I must divide it by delta time to obtain the impact force. Why are you calling it "impulse force", you have already divided it by delta time or I have to do this on my own?

    Could you please verify if you are already dividing the normalImpulse by Time.fixedDeltaTime and then correct the documentation?
     
    Last edited: Jul 31, 2019
  2. MelvMay

    MelvMay

    Unity Technologies

    Joined:
    May 24, 2013
    Posts:
    2,025
    We can remove the word "force", it is an impulse. This property is simply directly exposing the Box2D b2ContactImpulse as seen here which is past back to Unity via the Box2D PostSolve callback.

    I note that this is in reference to this other post too.

    FYI: Timing is good, I've just added the doc change to an internal PR so should land in the next week or so.
     
    Last edited: Aug 1, 2019
    Vasile-Peste likes this.
  3. Vasile-Peste

    Vasile-Peste

    Joined:
    Jul 23, 2018
    Posts:
    4
    Thank you for your time.
     
    MelvMay likes this.