[ODE] Spaceship movement.

Michael Molkenthin molle at michael-molkenthin.de
Tue Jun 20 04:35:20 MST 2006

hello folks,

this is exactly i am doing at the moment: Putting ODE into my space sim 
game "Elite-Starfighter".

Currently i am using dBodyAddRelTorque() to control the wings of a flyer 
from sight of the flyer itself.

The problem is to withdraw this torque in the next simulation step or 
downscale it during the following steps. To do this, i am getting and 
multiplying the current angular velocity with a negative value e.g. 
-10000.0f and adding this via dBodyAddTorque().

Of course, i had to play around with that scale value to get the smoothest 

Another point that i had to object: My Matrices initially were used to 
transform the mesh to world space. ODE seems to use matrices transforming 
the world to the local object/mesh space. So i am transposing the matrices 
after dBodyGetRotation(). Otherwise dBodyAddTorque() and 
dBodyAddRelTorque() are swapping their jobs.

After heavily messing around with that blindly, I hope this is the right 
way to do it.


On Tue, 20 Jun 2006, Geoff Carlton wrote:

> This has come up before.  The main approaches are to use AMotors for the
> control loop, or applying the forces manually (essentially having a
> control loop in the app code rather than in the ODE motor code).  I'd
> recommend the second approach - correcting forces should really come
> from engines etc which may want to generate particles etc depending how
> much force they emit.  Also AMotors are harder to understand.
> Instead of applying the velocity directly, compare the desired velocity
> to the current one and apply a suitable force.  For a spaceship, I'd
> expect this to be one force along the ship's axis representing thrust,
> and torque forces for stability and turning.  I'd recommend playing
> around with some dot/cross products, and get some code that injects a
> certain force and torque each frame.  A good interface is to take inputs
> as the expected control scheme (forward, left turn, automatic
> stabilisation etc).  AI can then resolve itself to injecting those
> inputs, rather than deal with the physics directly.
> Good luck!
> Geoff
> Christian Flodihn wrote:
>> I am trying to make a combat space simulator similar to
>> "Tiefighter" (released by Lucas Arts around 93-95).
>>  Now I got my tiefighter, a few empy containers and a
>> freighter in empy space.
>> I searched the net and read the ode user guide but I found no
>> examples mirroring what I want to accomplish.
>> For now I just set the linear velocity on the bodies, but I read
>> in the user guide that is wrong. I tried to use motors but I can
>> not figure out how to make them move the body like a spaceship.
>> Since you are the experts, you probably could give me some
>> advice how to do it.
>> //Christian Flodihn
>> ------------------------------------------------------------------------
>> _______________________________________________
>> ODE mailing list
>> ODE at q12.org
>> http://q12.org/mailman/listinfo/ode
>> ------------------------------------------------------------------------
>> No virus found in this incoming message.
>> Checked by AVG Free Edition.
>> Version: 7.1.394 / Virus Database: 268.9.1/369 - Release Date: 19/06/2006
> _______________________________________________
> ODE mailing list
> ODE at q12.org
> http://q12.org/mailman/listinfo/ode

More information about the ODE mailing list