Reflect an angle of a ball

Monkey Forums/Monkey Programming/Reflect an angle of a ball

lonnieh(Posted 2015) [#1]
I'm really trying to understand some seemingly basic stuff here and having a hard time. I have pressed myself to read read read about this but with my knowledge gap everything looks like it starts out on chapter 30.

I have a 2D ball on the screen. I have the following variables for the ball: X, Y, Angle, and Velocity. I set the angle and give it a velocity. I then calculate the X and Y on update like this:



I have a paddle to strike said ball, but the angle of paddle will change based on user input. I know the angle of the paddle, but how do I calculate the new angle of the ball after it collides?


nullterm(Posted 2015) [#2]
I think something like this? Assuming WallNormalAngle is the angle pointing out of the wall (not along the wall's line). So 90 degrees from the angle of the wall's line.





I've always done it using vector vx,vy, not speed & angle. So I'm guessing a bit.


lonnieh(Posted 2015) [#3]
Hey, thanks for the reply. I actually did not understand what a normal was until you described it. Now I am off to make your code do my bidding, thank you!