#### Howdy, Stranger!

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

#### Categories

We have migrated to a new platform! Please note that you will need to reset your password to log in (your credentials are still in-tact though). Please contact lee@programmersheaven.com if you have questions.
Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

# 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-

· ·