- #1
maltmana
- 5
- 3
Hi! first time poster here.
I'm making an orbital simulation and I am having a problem with one minor detail.
The gravity is working great, and I've programmed it using this formula:
A force vector is applied = DirectionOfCentralBodyNormalized * ((GravConstant * centralbodymass * orbitalbodymass) / (distance^2)
This works great and there are no problems here as far as I'm concerned.
Now here is the problem:
I want the orbital body to start off with enough angular velocity to orbit in a perfect circle. So I use this:
AngularForceVectorAdded = PerpindicularToDirectionOfCentralBody * (SQRT(centralbodymass * orbitingbodymass * gravConstant) / planetObjectDistance))
The problem is that this formula only works when I set the mass of the orbiting body to 0.0004. If I increase the mass of the orbiting body, not enough force is applied. If I decrease the mass, too much force is applied.
I have also tried multiplying by the mass of the orbiting body, but this causes the inverse to occur: increasing mass causes too much force to be applied and decreasing mass causes too little to be applied.
The orbit is nice and circular no matter where I place the orbiting object relative to the central body, but I really have no idea what I need to add to make this work for any amount of mass!
Thank you
I'm making an orbital simulation and I am having a problem with one minor detail.
The gravity is working great, and I've programmed it using this formula:
A force vector is applied = DirectionOfCentralBodyNormalized * ((GravConstant * centralbodymass * orbitalbodymass) / (distance^2)
This works great and there are no problems here as far as I'm concerned.
Now here is the problem:
I want the orbital body to start off with enough angular velocity to orbit in a perfect circle. So I use this:
AngularForceVectorAdded = PerpindicularToDirectionOfCentralBody * (SQRT(centralbodymass * orbitingbodymass * gravConstant) / planetObjectDistance))
The problem is that this formula only works when I set the mass of the orbiting body to 0.0004. If I increase the mass of the orbiting body, not enough force is applied. If I decrease the mass, too much force is applied.
I have also tried multiplying by the mass of the orbiting body, but this causes the inverse to occur: increasing mass causes too much force to be applied and decreasing mass causes too little to be applied.
The orbit is nice and circular no matter where I place the orbiting object relative to the central body, but I really have no idea what I need to add to make this work for any amount of mass!
Thank you