Angle to coordinates - Programmers Heaven

#### Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

# Angle to coordinates

Guest
How can coordinates be changed according to the current angle?

MySprite.Angle = 90; // (0-360)

MySprite.UpdateVelocity();

Can someone refer a book/tutorial on velocity/angle?

• Guest
: How can coordinates be changed according to the current angle?

:

: MySprite.Angle = 90; // (0-360)

: MySprite.UpdateVelocity();

:

: Can someone refer a book/tutorial on velocity/angle?

Angle = Direction you want to go (0-360)

M = Magnitude (how far you want to go in that direction)

x = M*cos(angle);

y = M*sin(angle);

angle = arctan (y/x);

-Xotor-

• Guest
Don't you need to convert the degrees into radians?

angle = angle between 0 and 360

M = magnitude, speed or force (like xotor said)

new_y = M*sin(angle*PI/180)

new_x = M*cos(angle*PI/180)

just a thought...

/ pelle

URL:home.swipnet.se/wizard

• Guest
Hey Pelle

When using ArcTan you will *get* result

in radians, and therefor you can just

push it in to the other trig functions such

as sin, cos.. etc. which expect the

argument to be in RADIANs.

bye

• Guest
: Don't you need to convert the degrees into radians?

Dunno, actually I wasn't referring to the cos(), etc. functions, just cosine in general. I don't normally use the trig functions().

-Xotor-