Convert a single radian value to a vector direction

I work in XNA.

I have a float value called "Rotation". This is from -3.14 to 3.14. It indicates the rotation of the sprite.

I want to use this value to create a vector with values ​​for rotation on the X and Y axis.

For example, if the sprite is rotated right right, I want to get the value (1, 0).

If it turns straight up, I want (0, -1). You get an image.

How can i do this?

+3
source share
1 answer

You use sine and cosine:

( Math.Cos(rotation), Math.Sin(rotation) )
+5
source

All Articles