Skip to main content
GameDev.net gamedev.net
🔒 Locked

Really simple stuff..

Started by Laroche Feb 21, 2003 at 5:38 PM 1 replies 300+ views
Original Post
Laroche
Laroche
If a given object is facing angle R, and the user advances forward, what would be the new X,Y coordinates of the object? Somehow in my head I realize this is easy, but I just can''t seem to figure it out for some reason..
Check out my music at: http://zed.cbc.ca/go.ZeD?user_id=41947&user=Laroche&page=content
Laroche
Laroche
ok, figured it out on my own heres my solution, if anyone was curious for some reason:


Position.x += sin(Direction) * Velocity;
Position.y += cos(Direction - PI) * Velocity;
Check out my music at: http://zed.cbc.ca/go.ZeD?user_id=41947&user=Laroche&page=content
rypyr
rypyr
You have to clarify two things in your question:

1) from what axis the angle R is made
2) whether you have a left-hand coordinate system or a right-hand coord system

For a right-hand coordinate system (+x axis goes to the right and +y axis goes up), with the angle being measured from the x-axis, the equations are:

Pos.x += cos(R) * Velocity
Pox.y += sin(R) * Velocity

If your equations work, then I guess your angle is made w.r.t the y axis and you have a left-hand coordinate system (since cos(R+PI) = -cos(R)

Topic Locked

This topic has been locked by a moderator. New replies are not allowed.

Sign in to reply to this topic.