Hoi, I'm trying to make a game based (very, very) loosely on Arkanoid. In fact, the only similarity it has to arkanoid is the ball and paddle. However, my paddle can rotate around it's axis to change the angle of the shot, and I'm afraid the ball may be to small for an accurate bounce angle based on fine collision.
Anyway, since I'm failing maths, I was wondering if anyone had any insight on how to make it bounce properly, perhaps using the animation direction of the paddle.
Part of the problem is that because the paddle rotates 360, it's possible to hit the ball off of the back.
If you take the normal of the bat, then the angle the ball bounces at will be the angle that it hit at, only reversed around that normal.
So, if your bat is facing direction 6 and the ball is traveling in direction 20 when it collides, then it will reflect at direction 12.
Though there are going to be problems with something this simple, for example, if it hits the side of the bat rather than the face then your going to have problems unless you code that in (which is going to be difficult.
But it's up to you, if you want to put that much work into it. You can probably get away without coding it, because "normal" people will use the main part of the bat instead of trying to be trickey, but it still may happen by accident.
Mike
"Now I guess we're... 'Path-E-Tech Management'" -Dilbert
Thanks, I figured out a simple solution for the correct angle using 32 directions.
With the paddle animation skewed 90 degrees (so that direction zero looks like dir eight):
Ball direction = Dir( "Paddle" ) - ( Dir( "Ball" ) - Dir( "Paddle" ) )
That seems somewhat redundant to me, but it works perfectly so I'm not going to bother fiddling with it.