My set up is, I have a simple rocket, on a real-life sized earth globe. My gravity vector is always pointing towards the center of the globe, no matter where on the globe I am. I have a rocket, standing upright, so its thrust vector is coaxial with the gravity vector.
In its purest form, my code is:
- Code: Select all
dVector gravityForce(...);
double gravmag = vLength(gravityForce);
dVector thrustForce(...);
double thrustMag = vLength(thrustForce);
// debug printout
double angle = 0.0;
angle = GetVectorAngle(gravityForce, thrustForce); // calculates angle between 2 vectors
if (thrustmag > 0.0)
fprintf("Gravity: %f -------Angle: %f---------- Thrust %f\n", gravmag, rad2deg(angle), thrustmag);
dVector totalForce = gravityForce + thrustForce;
NewtonBodyAddForce(body, &totalForce[0]);
When I run my simulation, the printout of the debug code is:
- Code: Select all
Gravity: 823750.200000 -------Angle: 179.998895---------- Thrust 7440000.000000
The result is, the rocket is stubbornly still. As you can see, thrust is much larger than gravity, and the forces are in opposite direction, so the rocket should take off vertically!
There are NO other NewtonBodyAddForce or NewtonBodySetForce calls in my sim. The rocket is perfectly still, pointing upwards on the surface of the sphere.
Now, for the sanity check, I scale up the thrust 10x in the second last line of code:
- Code: Select all
dVector totalForce = gravityForce + thrustForce.Scale(10.0)
and sure enough - the rocket takes off like a bullet! What is happening here? Why isn't the larger thrust force overcoming the gravity in the first (non-scaled) case? Is it the inertia of the heavy body? Even with a large mass, the force would eventually push it... This is driving me crazy - what am I not seeing???