This piece of code has been taken from a game built with XNA framework. I'd like some explanation of how it works in terms of trig and physics.
ball.velocity = new Vector2((float)Math.Cos(cannon.rotation), (float)Math.Sin(cannon.rotation));
ball.rotation is the rotation of a sprite in what i should think, radians.
Why is it that they can use the angle in radians only to find the x position then the same thing to find the y position of a direction of where the hypotenuse is pointing.
Reason why I asked this. I would like to get a feel of how this frameworks does calculations for trig. I am trying to get a sprite to turn in the direction of where the mouse is, that is: x and y is known, i just need the angle.
So there are 2 questions here. explaining that code above and pointing a sprite in the direction of a known point.
Update:
I found out that the point a which the object is at is not (0,0) because xna uses inverse coordinate system. So now the variables I have are these:
point of object. point of mouse.