[ODE] Questions about representing motion in ODE

Jon Watte (ODE) hplus-ode at mindcontrol.org
Mon Mar 13 11:52:34 MST 2006

Jean-Sebastien Guay wrote:

> Ok, that's interesting. I assume those two are in addition to the forward force
> I'm applying as thrust, since they both have a very small multiplier in them,
> correct? Also, I assume I'd have to apply both at every time step, using the
> time between frames as a multiplier too?

Every step, yes. Time as multiplier: no. The force turns into an 
impulse, and as such, is already multiplied by time step the next time 
you step. However, it sounds as if you're not using a fixed time step -- 
you should be. (The FAQ and Wiki talks about why)

> Actually, since we're in an arcade concept, we were going to make the sub move
> more or less like an airplane in that respect. If we need to go toward the
> bottom or the surface we point the sub down or up and it goes that way. We
> might add a way of going straight up or down when stopped, but it won't be the
> primary movement mode.

So up/down movement should be dampened just like left/right movement.

>>Use a controller. You want rotation X, but you currently have rotation Y
>>with rotational velocity R. Apply a torque which is proportional to
>>(X-(Y+R*TimeStepSize)), each step. This will make the sub "trend"
>>towards the rotation you want. This works fine in euler angles, although
>>there is some inaccuracy due to the cubic as opposed to square
>>coordinates). In an arcade game, nobody will notice.

> Err, I'm going to have to ask you to take it a bit slower... What's a
> controller? I didn't see that in the ODE User Guide. What does Rotation X,
> Rotation Y and Rotational Velocity R represent? (yaw, pitch and turn rate I
> guess?)

"controller" as in process theory. You don't get one in ODE (unless you 
count amotors), so you implement it yourself. Rotation X and Y are just 
arbitrary rotation variables (expressed as tuples of euler angles, or as 
quaternions). Call them A and B instead. R is your angular velocity 
(which conveniently comes in an Euler-like tuple from ODE).

> Basically, we would like the mouse X and Y axes to control yaw and pitch more or
> less. If the sub is stopped, it would just rotate about itself, and we could
> point it in any direction with those two axes. Would what you suggest work for
> that?

That's basically a FPS controller. I'm assuming you want to clamp Y to 
+/- 80 degrees or so.

You just modify the deisired rotation based on those two inputs, and 
it'll work fine. Beware that you deal with the wrapping case -- if your 
current heading is 359 degrees, and you want to head in 1 degree 
direction, then the delta should be 2 degrees, not -358 degrees :-)


			/ h+

More information about the ODE mailing list