Should work for what ever angle you want to point at.

Give or take some dt. Just so long as its a straight line.

You'll have to call R0J0hound back for curves.

19 posts
• Page **2** of **2** • 1, **2**

newt wrote:oldX + cos(yourangle) * (30*10)= new x

oldY + sin(yourangle) * (30*10)= new y

Should work for what ever angle you want to point at.

Give or take some dt. Just so long as its a straight line.

You'll have to call R0J0hound back for curves.

It's not adding up see below:

NewX = 2000 + cos(95 degrees) * (30*10) = 1973.85327718

NewY = 528 + sin(95 degrees) * (30*10) = 826.858409428

So after traveling for 30 seconds on a heading of 95 degrees, the dot will be at 1973, 826 ?

The NewX seems to be incorrect as the dot is going South East, the X value should be increasing not decreasing.

**Posts:**165**Reputation:**6,697

B

34
S

10
G

5
The math as newt wrote works. As you wrote it is incorrect, you added some parenthesis that weren't there.

Edit:

Well, since I posted you edited your post or some nonsense like that. So now the formula is correct and the numbers look to be in the range you'd expect. If you want to be more sure of the formula then I recommend reading up on converting polar coordinates to Cartesian coordinates.

Edit:

Well, since I posted you edited your post or some nonsense like that. So now the formula is correct and the numbers look to be in the range you'd expect. If you want to be more sure of the formula then I recommend reading up on converting polar coordinates to Cartesian coordinates.

Last edited by R0J0hound on Mon Mar 10, 2014 5:22 am, edited 3 times in total.

**Posts:**5,391**Reputation:**75,343

B

94
S

33
G

117
Its kind of hard to know whats happening as I don't know how you've got the movement set up.

You say physics, but that would lead me to believe its not a constant speed. So the 10 * 30 may be questionable.

Or perhaps the angle you are using is off as well.

All I can say is a rate of 10 pixels per second for 30 seconds should get you a distance of 300 pixels, and and angle of 95 would point south east if the origin was the east, or that way ->.

Thats the origin C2 uses.

You say physics, but that would lead me to believe its not a constant speed. So the 10 * 30 may be questionable.

Or perhaps the angle you are using is off as well.

All I can say is a rate of 10 pixels per second for 30 seconds should get you a distance of 300 pixels, and and angle of 95 would point south east if the origin was the east, or that way ->.

Thats the origin C2 uses.

**Posts:**8,438**Reputation:**115,095

B

172
S

50
G

182
I have removed Physics from the equation, it is and always has been a constant speed of 10 pixels per second.

Take a look here:

https://www.google.com/search?q=2000+%2B+cos(95+degrees)+*+(30*10)&rlz=1C1CHFX_enUS576US576&oq=2000+%2B+cos(95+degrees)+*+(30*10)&aqs=chrome..69i57j0.4111j0j7&sourceid=chrome&espv=210&es_sm=93&ie=UTF-8

I'm getting the same result, any idea what's wrong?

Take a look here:

https://www.google.com/search?q=2000+%2B+cos(95+degrees)+*+(30*10)&rlz=1C1CHFX_enUS576US576&oq=2000+%2B+cos(95+degrees)+*+(30*10)&aqs=chrome..69i57j0.4111j0j7&sourceid=chrome&espv=210&es_sm=93&ie=UTF-8

I'm getting the same result, any idea what's wrong?

**Posts:**165**Reputation:**6,697

B

34
S

10
G

5
19 posts
• Page **2** of **2** • 1, **2**