- #1

DaveC426913

Gold Member

- 19,099

- 2,613

**Orbit Simulation logic**

I'm building an Orbit Simulator (this is what I build every time I learn a new language). I'm looking for the pseudocode for calculating the acceleration.

I know the formula: G*m/(d2-d1)^2, I'm trying to figure out why I'd need the hypotenuse.

You see, I can calculate the accelX and accelY just from the x and y coords. Then I can udpate the x and y velocities, then I can update the x and y positions. Nowhere do I actually need to calculate the hypotenuse.

But this yields incorrect motion.

So, am I supposed to

1] calculate the

*hypotenuse*from the x/y coords,

2] then figure out the acceleration as a single scalar value along the hypotenuse

3] then immediately

*reconvert*the single scalar acceleration back into accX/accY?

Last edited: