Hi Julio!
Julio Jerez wrote:Basically what you want is a force and torque call back to apply force an torque to a body that is moving on a non inertial rotating frame. does that describe the problem?
Yes, that is it in a nutshell. As far as non-inertial frame, I am unsure what precisely you refer to, so let me describe my setup:
- my bodies are moving in an orbit around earth, in a gravitational field, and wherever the body is, a gravitational force vector that acts on the body points to the centre of Earth (and centre of coordinate system).
- At the start of the simulation, I give the body an initial velocity which I calculate to be exactly an orbital velocity at that altitude.
- The centripetal force produced by the angular velocity cancels out the gravitational force, and this puts the body in a perfect circular and stable orbit.
- If I give it less velocity, the object falls back to the earth, and if I give it more, it goes into elliptical orbit (or, even more, it escapes out of orbit, so called escape velocity) Unless I am missing something, this is a pure case of rigid-body dynamics
Now, I need to change the attitude of my rigid body (spacecraft) to point it in different directions. To do that, I wanted to use a thruster setup, where force is being applied at different points on the spacecraft. However, I didn't find a method to apply a force at some distance (there is only a method to apply force at the centre of gravity of the object). So, instead, I:
- Use 6 keys on the keyboard to apply +/- yaw, +/- pitch and +/- roll. I populate these values into a torque vector, for instance dTorque(-0.34, 2.72, 0.031)
- Use body's current rotation to rotate this vector and align it with body's principal axis
- Use NewtonBodyAddTorque to apply this torque in the body's axis (rotated)
- I then clear the dTorque vector for another cycle of thruster inputs.
- I do this within ApplyForceAndTorqueCallback
The part that got me confused is that why did not get good results by applying thrusters at some fix point. That method always works, and you do not have to worry about angle order.
did you try that?
I didn't try that because I didn't know HOW to do that in Newton

- Newton library has no method for that (unless i am missing something). Only methods available (NewtonBodyAddForce and NewtonBodySetForce) are applying a force at body's centre of gravity. So, since torque is produced when applying a force at some distance (line of axiom) from CG, I decided to try the torque approach, which seemed to work, but, as you warned me, this method is not the way do this.
So, yes, absolutely, I agree that applying torques is not the correct way to do it. I wanted to use thrusters,
but I just don't know how to set up the physics. Using basic physics, I was going to:
- Define a point on the body (away from CG), apply a force vector on it and calculate how much torque is produced by the force.
- The resultant of this force is a torque AND force, both acting on the body's CG
- Since a spacecraft has a pair of equal but opposite thrusters for every axis, I would apply the same but opposite force on an opposite end, which would result in another torque and force acting on CG, except the force would be of same magnitude, but opposite.
- This would cancel out the forces, leaving only torque on CG... Which is equivalent as applying pure torques. Which is what I did, from the outset
So, to sum up, I absolutely agree with your reasoning of applying force vectors on line axioms - I just don't know HOW to do it
One idea I had was to add actual Newton "child" bodies to various parts of my "parent" spacecraft body using a "hard" joint (CustomHinge, with all limits set to 0?), and apply pure forces on those bodies. They would be then acting as actual thruster boxes, locations away from the body CG at which the forces would act. However, this is probably a bit of an overkill...
Thanks,
Misho