Unrealistic 2D Bouncing
Hi. For my project I am trying to create a physics puzzle game with a ball that bounces off a wall with a zero loss of friction/momentum. For my "wall", I am using a 2D Box collider, with a physics material that has 1.0 Bounciness, and a 0.0 Friction level. For my "ball", I am using a 2D circle collider, with the default physics material. Both objects have rigidbodys and a renderer (obviously).
My problem is that when the ball is lauched at an angle (compared to the wall), it bounces back in the same direction it is launched, instead of the opposite direction. Here is a horribly made MS Paint drawing to further explain:
Does anyone know what could be causing this? It is very frustrating and makes the game unpredictable and unplayable. Thanks in advance.
Josh
Answer by hexagonius · Aug 24, 2015 at 04:21 PM
My guess is, that a PhysicsMaterial2D accounts for the Rigidbody2D it is attached to. In your case, the wall is bouncy, NOT the ball, and I think is therefore not taking any incoming directions into account. Try switching the material over to the ball so it will bounce off.
That works perfectly!
I can't believe I didn't think of that...
Thank you so much!!
Answer by Wolfshadow · Aug 24, 2015 at 04:10 PM
I believe it is the angle of the wall. Maybe if you had a pad at an angle pointing slightly up, it would bounce up. Or, have the ball continually move up slowly if not touching the ground. Sorry, I know these are not perfect.
Your answer
Follow this Question
Related Questions
(2D) Movement-Animation Problems 0 Answers
Problem getting dropped bombs to behave properly 0 Answers
2D ledge grabbing -1 Answers
Max velocity and constant acceleration 0 Answers