Search Unity

My ball bounces (rebounds) on the paddle without physics material

Discussion in '2D' started by castingflame, Jun 9, 2016.

  1. castingflame


    Jan 29, 2016
    I am following a Unity course for beginners and I am stuck on one aspect of a bat and ball breakout type game.

    We are covering colliders.

    I have a ball that has a RidgidBody2D, a CircleCollider2D and 'Is Trigger' is not set. 'Is Kinematic' is not set. so the ball is a RidgidBody collider.

    I have a paddle that has a RidgidBody2D, a Box Collider2D and 'Is Trigger' is not set. 'Is Kinematic' is set. so the paddle is a Kiematic RidgidBody collider.

    When I add a a PhysicsMaterial2D with a Friction of 0 and a Bounciness of 1 the ball gets higher and higher with each bounce when it should be the same bounce each time.

    Fault finding
    I remove the physics material from the ball so I know this is not in the equation. When I step through the scene the ball and paddle are overlapping when they 'colllide'. At that point the ball then reverses direction and moves away from the bat until the bat and paddle collision boxes (green) are touching then they come to rest. It looks like the ball is actually rebounding. Is this normal?

    I have watched the tuition video over and over and even deleted everything and re done it a few times but I still have the same result. I am stumped.

    Thanks for any advice that you can give.
  2. jeffreyschoch


    Jan 21, 2015
    Try setting the Rigidbody2D to "Continuous Collision" as well as setting the interpolation mode to "Interpolate" or "None".

    I think what you are seeing is the result of fast-moving objects using Discrete collisions. This means that if the objects are moving fast enough, they can be seen overlapping before the physics system adjusts their positions.
  3. derianmeyer


    Nov 17, 2016
    Thank you Jeffrey! I was looking for an answer for over an hour before coming across your post. Changing the Collision Detection from "Discrete" to "Continuous" fixed the problem for me.
    jeffreyschoch likes this.