# How to find the resulting angle of a ball hitting a wall in 2D

So there's a ball moving on a 2D plane with any vector. When it comes into contact with a collider, it should reflect in a linear fashion. What formula should be used in order to find the angle that this new direction should have? The pieces of information that are known are:

• The X and Y velocity of the ball when it was hit
• The angle it was travelling at when it was hit
• The point of contact

I've found many solutions for if the ball can only hit vertical or horizontal walls, but have yet to find a one for a general case.

• We usually don't do this with angles, but by reflecting the velocity vector along the collider's normal. Do you have these two vectors, or are you required to work in angles here? – DMGregory Nov 8 '18 at 8:19
• I have the ball's vector and angle. I'm wondering how to find the collider's normal which I've collided with. If I'm able to find the resulting x and y components of the reflected vector then I can find the new angle too, I know the equation to do that. How would I find the collider's normal and the resulting vector? – Morgan Nov 8 '18 at 21:21
• How are you detecting the collision in the first place? OnCollisionEnter2D, OnTriggerEnter2D, raycasts/circlecasts, or some other method? – DMGregory Nov 9 '18 at 0:00