Search Unity

  1. Megacity Metro Demo now available. Download now.
    Dismiss Notice
  2. Unity support for visionOS is now available. Learn more in our blog post.
    Dismiss Notice

Collision.impulse

Discussion in 'Physics' started by radialxawn, May 13, 2019.

  1. radialxawn

    radialxawn

    Joined:
    May 13, 2019
    Posts:
    29
    Hi! I am a beginner. I have a question:
    How to get impulse at each contact point of a rigidbody.
    I want to calculate force at each chair leg or something like that.
     
    Last edited: May 13, 2019
  2. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,497
    Hi, and welcome to the Unity forums!

    Easy. Just create a new script, write the OnCollisionEnter method, and add the script to the GameObject that contains your Rigidbody. You'll receive the impuse in the collision information. Here's a "Hello World"-style example:


    The collision argument that is passed to OnCollisionEnter includes the impulse information:


    Have fun!
     
  3. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,497
    Oh, I've just realized that you explicitly asked for the impulse "at each contact point". Unfortunately, that information is not exposed in Unity. Only the global impulse for the entire collision is available.

    Indeed, I'd also like to have the impulse per contact point exposed. I've already asked the Unity developers about this. Hopefully it will be exposed in a future Unity version.
     
  4. radialxawn

    radialxawn

    Joined:
    May 13, 2019
    Posts:
    29
    Thank you for your answer.
    But when i calculate force using impulse value on a 1500kg rigidbody with 4 contact point at gravity of 10m/s the result is 3750 ??? the result is 15000 for 1 contact point. Do you have any idea about that.
     
    Last edited: May 13, 2019
  5. Edy

    Edy

    Joined:
    Jun 3, 2010
    Posts:
    2,497
    I had researched this some time ago, and the conclusion at that time was that Collision.impuse is something like the average of the individual contact impulses. Plainly useless for my use case.
     
  6. radialxawn

    radialxawn

    Joined:
    May 13, 2019
    Posts:
    29
    Well, actually i decided to make an arcade car with sphereCollider and i am stuck at the suspensionSpring. : ) . I just want to replace Raycast with sphereCollider. Do you have any advice ?. :})
     
    Last edited: May 13, 2019