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

Manual bouncing calculation not working

Discussion in 'Physics' started by sebastianp_big, Mar 11, 2020.

  1. sebastianp_big

    sebastianp_big

    Joined:
    Oct 1, 2015
    Posts:
    6
    Hi everyone,

    i am currently trying to find a way to let one object with a rigidbody bounce of a collider. Usually this would be done by using the physics materials and just setting the bounciness to the appropriate value.

    The problem is: I can not set the bounciness to something higher than 1.0 ... A bounciness of 1 means a perfect bounce, no energy loss. But i want to create an object that can accelerate objects. Basically i would like to set bounciness to something greater than 1 :)

    An example: An object falls from a height of 10 units on the collider. I want it to be able to reach 11 units in height after bouncing of. And i want to be able to configure this freely.

    I tried a lot of different strategies from simply reflecting the velocity with the collision normal to adding forces using different force modes but in the end it all has the same problems. Sometimes it randomly looses speed. I.e. it falls towards the collider with a velocity magnitude of 40 and it bounces off with a magnitude of 9.

    So at the moment, i am stuck... I dont know what to try and i dont know what is going wrong...

    Any ideas?
     
  2. sebastianp_big

    sebastianp_big

    Joined:
    Oct 1, 2015
    Posts:
    6
    I think i might have found the culprit: It seems that the velocity that is reportet from the collision event in OnCollisionEnter is the velocity after the collision (Because OnCollisionEnter is called after FixedUpdate). If i save the velocity from the previous physics frame and use it instead, it looks to be perfectly controllable and stable. Further testing required...