- Home /
Box Edge Collision Problems
Hi, I am making a game a little like brick breaker. You shoot a ball at boxes, then the box breaks and the ball should rebound. Instead of using a sphere collider for the ball I want to use a box collider, to insure that the ball always bounces of perfectly.
Now, when I shoot the ball at the box and the point of impact is the corner the ball bounces of in a random direction and looses velocity, although I am using no friction.
I locked rotation, decreased time-steps, changed options in physics settings, tried to fix the problem with code and etc. Nothing seems to fix the problem. I am using a lot of OnCollision functions, it would be quite hard to use raycasting I believe. Because I would have to change loads of scripts. Is there a way around this? If I were to use Raycasting how would I do it? Thanks :)
Did you ever find a solution to this? I'm having a similar problem...
I came up with a work around, at the end I wrote a piece of code that detects where the box collided (the contact point) and then I changed the velocity accordingly.
So, if I detected a collision on the top/bottom half, I inverted the vertical velocity of the object.
And if I detected a collision on the left/right side, I inverted the horizontal velocity.
I believe the new Unity 2D options solved this problem though. Good luck developing!
Yeah, that's the only solution I could think of, but my game is in 3D, so It's getting a little more complicated. The main problem is when the ball hits the point between two or more blocks...
Thanks for your answer, though! =)
What will happen If you enclose 100% bouncing material to the collider ?
Your answer
![](https://koobas.hobune.stream/wayback/20220613121117im_/https://answers.unity.com/themes/thub/images/avi.jpg)
Follow this Question
Related Questions
Cubes wont Collide 1 Answer
Unity Collison Problem 1 Answer
how do i correctly use a box collider 1 Answer
Internal collisions 1 Answer
Rigid Body and Collision practice 1 Answer