Answer the question
In order to leave comments, you need to log in
Unity how to calculate the angle of the ball bouncing off the wall?
I'm making a simple 2D pong game (I think everyone knows what it looks like), I need to calculate the angle of the ball's rebound when it hits a wall (or racket), does anyone know the formula?
Answer the question
In order to leave comments, you need to log in
if the relative position of the walls is parallel to the coordinate axes (i.e., either a vertical or horizontal obstacle), then when it hits a horizontal wall, the speed along Y changes to the opposite (the sign changes) and does not change along X, but with a horizontal wall, on the contrary, along Y does not change, but X changes the sign to the opposite (multiply by -1)
if the obstacles have an arbitrary angle, then ... you can see the formulas here
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question