- Home /
2D Pong Ball Not Reflecting Off Walls "Exactly"
Hi. New to Unity. Making Pong. Here's a GIF of the problem I'm facing:
As you can see, when the ball hits a wall at a certain angle, it no longer reflects off.
The ball has a Rigidbody2D
and a BoxCollider2D
with a material that's bounciness==1 and
friction==0`.
The walls are made up of BoxCollider2D
's.
So far as I can tell, this "lack of bounciness" is normal behavior for such angles.
However, is there any way to get around this?
Perhaps manually messing with the ball's velocity via it's OnCollisionEnter2D
method?
PS - My source code can be found here.
Edit: Looks like this guy had the same issue, but unfortunately didn't find a solution.
@meat5000: With friction==1
: http://i.imgur.com/ovsA9tV.gif
@d2: Tried adding a material to the walls (`friction==0` and bounciness==1
). It had no observable effect.
Answer by meat5000 · Mar 07, 2015 at 02:47 AM
Lower your Velocity Threshold to 0.1
Project Settings -> Physics2D
Described as "Any collisions with a relative linear velocity below this threshold will be treated as in-elastic"
Agree, just awesome! Fixed this issue across the top of my court with the simple handball game I was developing as my first unity project. Thanks!
Your answer
Follow this Question
Related Questions
Character slows down when running against a wall (2D) 1 Answer
My RigidBody2D+BoxCollider2D is getting stuck on corners 1 Answer
Rigidbody2d getting stuck when moving horizontally at random points! Can't figure it out :( 1 Answer
Collision of child is detected as collision of parent with Rigidbody2D 0 Answers
How to select the trigger layer on a Box Collider 2D 2 Answers