How to find initial direction and angle of collision of a ball with a vertical wall?

150 Views Asked by At

I have a problem in my game. I have a wall where a ball hit to a wall from anywhere. I need to give it to the direction according to the collision law.

Let suppose if a ball thrown from $(0, 0)$ and collides at a vertical wall on $(10, 10)$ then it will bounce back to $(0, 20)$. This law applies when all other factors remain constant.

Now my problem is I have the coordinates of the initial position and the collision point. How can I find the final position where it will bounce back, according to the above rule?

1

There are 1 best solutions below

0
On BEST ANSWER

If it is always bouncing off of a vertical wall, and according to your example rule, a ball starting from $(x_1,y_1)$ and bouncing at $(x_w,y_w)$, it should end up at $(x_1,2y_w-y_1)$.