I'm testing some vector reflection and I want to check what happens when a ball collides with a paddle.
So if I have:
Vector2 velocity = new Vector2(-5, 2);
position_ball += velocity;
if (position_ball.X < 10)
{
Vector2 v = new Vector2(1,0); // or Vector2.UnitX
velocity = Vector2.Reflect(velocity, v);
}
then, correctly, velocity is (5,2) after Reflect
,
but if I do:
if (position_ball.X < 10)
{
Vector2 v = new Vector2(1,1);
velocity = Vector2.Reflect(velocity, v);
}
then velocity is (1,8) and not (5, -2) that is the solution of reflection equation R = V - 2 * (V . N)
Why is that?