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

2d ball (sprite) bouncing is unnatural - keeps bouncing (when in reality it will be rolling)

Discussion in 'Physics' started by mosh999, Mar 17, 2019.

  1. mosh999

    mosh999

    Joined:
    Feb 22, 2019
    Posts:
    18
    Hi all,

    I am facing a problem with my 2d physics game.

    I have a simple 2d simulation where I have ball sprite, with 2d rigidbody and a platform.
    The rigid body has a gravity scale applied and has a material with bounciness applied.

    When the game starts, the ball drops and bounces as it should and eventually gets close to the platform. When the ball is virtually touching the floor and not even moving, it seems that it's actually still colliding against the platform several times per second - I can tell this because I have created a variable which counts the number of collisions of the ball against the platform (incremented by each call to OnCollisionEnter2D on the ball's controller script).

    To give an example of various settings i've tested with:

    Ball gravity scale can be set to 2, or 9.8.
    Ball bounciness=0.5, 0.7
    Mass of ball = 1, or 10, or 20

    In each of these cases, ball keeps bouncing hundreds of times even when it's virtually touching the floor and you can visually see a mini bounce occur.

    This behaviour does not reflect the real world physics. I don't know how to fix this problem. Perhaps there is a reasonable explanation for this and there are configuration settings that can fix the issue.

    It seems is a very elementary problem I'm facing, so I am hopeful that there is a simple solution out there for this. I have read the forums and found no appropriate answer.

    I would really appreciate if someone can get back to me asap as it's blocking all my progress at present.

    Many Thanks