AS3: Rotation into Vector

actionscript-3, bitmap, rotation, vector

Solution

You can do it this way, using Trigonometry:

//convert degrees to rads
var rads:Number = bitmap.rotation / 180 * Math.PI;
//get the vector, I am using a point
var p:Point = new Point();
p.x = Math.cos(rads);
p.y = Math.sin(rads);

Now if you want to move the bitmap in the direction you just do this:

bitmap.x += p.x * speed;
bitmap.y += p.y * speed;

Problem

Hey I am rotating a bitmap in actionscript3 and after finishing the rotation I want to update the direction is facing so I stored the degress that the bitmap was rotated for example rotation = 90° and now I want to convert this into a vector (x,y) to figure out which direction the object is now facing thx in advance

Original source