Hi, first time posting here. I'm having problems with some trigonometry calculations in as3. Here's the swf file, i can move the ship forwards and backwards but things get weird when i try to move it sideways.

Here's the code;

//this moves the ship forward vx += Math.cos(rotation* Math.PI / 180) * 3; vy += Math.sin(rotation* Math.PI / 180) * 3; //and this should move the ship to its right vx += Math.cos((rotation+90)* Math.PI / 180) * 3; vy += Math.sin((rotation+90)* Math.PI / 180) * 3;

I have no idea what i'm doing with these stuff i just took the calculations from a tutorial. Why this isnt working?

Thanks in advance!

ps: Here's some additional info;

//ship's location is updated like this in every tick x+=vx; y+=vy; //and i calculate the angle of the ship like this; rotation = (Math.atan2(y-stageRef.mouseY,x-stageRef.mouseX)*180/Math.PI)+180;