Search Unity

Ball acquires energy when bouncing

Discussion in 'Physics' started by Stobby, Jan 11, 2015.

  1. Stobby

    Stobby

    Joined:
    Jun 29, 2014
    Posts:
    4
    Hi all,
    I've begun learning how to use Unity Physics engine by creating a simple example which is the "Ideal Free Fall" of a ball.

    I've prepared a surface and a ball which falls from the sky.
    The ball has the rigidbody component inside itself while the surface has only a box collider.
    Both the ball and the surface have a simple Physic Material which has this setup:

    Friction (Dynamic and Static): 0
    Bounciness: 1
    Friction combine: Minimum
    Bounce combine: Minimum
    Friction Direction 2 (and others): all set to 0.

    The ball has no angular drag and no drag at all.
    The surface is not moving.

    While I start the simulation the ball begins rebounding as expected with the exception that for every rebound it makes the ball acquires some energy and goes higher than the starting point.

    I'm a bit confused... is there any parameter I did not consider? Mass of the ball is 1 and the interacting surface has no rigidbody component.

    Thank you in advance for your answers.
     
  2. niebau

    niebau

    Joined:
    Aug 18, 2012
    Posts:
    3
    I had a very similar 2D setup with the same issue, and in my case the problem seemed to be related to the scaling of the ball:

    - A ball with a circle collider 2D and a rigidbody (mass=1, gravity=1, no linear or circular drag)
    - Physics Material attached with friction 0 and bounciness 1
    - A horizontal platform below with a 2d box collider. No rotation
    - No transform manipulation or 'manually' adding forces in any way

    For each bounce the ball got more momentum, bouncing higher and higher.

    What fixed the issue for me was setting the scaling of the ball back to (0.8f, 0.8f, 0.8f) from (0.8f, 09f, 0.8f).
    Apparently the 'uneven' scaling of the ball had an impact on the energy gain.
    I still wonder, though, whether this is intended behavior or a bug of the physics engine respectively Unity3D.

    If you have an animation attached to your ball, you also want to make sure that the animation doesn't modify the ball's transform (in doubt uncheck 'Apply root motion' in the corresponding Animator).
     
    Last edited: Mar 11, 2015