- Home /
Bounce physics material not working
Hey guys I have a problem with my current build of my Brick Breaker game. I am trying to make the ball bounce off of everything so I put a physics material on it which has a bounciness of one and no friction at all. None of the other objects have friction either. It works well except for one flaw. When is bounces it can greatly change velocity, which wouldnt be a problem except when the velocity is change to a very low number. When this happens and it tries to bounce against a wall it will just set the velocity to 0 instead of reversing it. This means instead of bouncing, I have a ball that just moves up and down a wall, or side to side on a top wall or paddle. I am not sure how to use these physics materials to my desired effect, and any help is appreciated. Thank you
Hi, Unity physics system is ok to simulate lots of things but it's not made to simulate something like a brick breaker gameplay. I mean, even if bounciness is set to 1, there are some other limitations, like floating point approximations and a few epsilon here and there in computations that may change the velocity.
I would suggest to add some OnCollisionEnter callback to the ball and make sure the velocity is kept at the same magnitude after each collision. Something like velocity = velocity.normalized * $$anonymous$$yVelocity; Also, I guess there must be some tutorials you can check that do exactly that.
Answer by MorsVitae · Apr 15, 2016 at 04:41 AM
The problem was the speed was below the bounce threshold. Moving that to 0 fixed the problem.