• Welcome to Dark Bit Factory & Gravity.
 

Getting a second co-ordinate

Started by mike_g, March 12, 2007

Previous topic - Next topic

0 Members and 1 Guest are viewing this topic.

mike_g

Its kind of embarrasing asking such a simple maths question but:

Say I have a start x/y co-ordinate, an angle in degrees, and a distance. How can I get the end x/y co-ordinates from this?

zawran

If I remember correctly, you can do it something like this:


endXpos = startXpos + sin( angle ) * distance
endYpos = startYpos + cos( angle ) * distance

mike_g

#2
Thanks man, I'll try that out.

[edit]Yeah works fine :)[/edit]

Shockwave

Don't be embarrased asking questions, simple or difficult they keep the board alive :) Have some good karma guys.
Shockwave ^ Codigos
Challenge Trophies Won: