# [ODE] Ode modelling

Jon Watte (ODE) hplus-ode at mindcontrol.org
Tue Sep 4 08:42:02 MST 2007

```You can create your own joint, that only constrains sideways rotation,
not twist, roll, or position. This isn't well documented, but you can
probably start with the hinge joint code and rip out the position
constraints.

To control an object, it's often easiest to add manual torques and/or
forces each step, based on where you want to go, and where the object is
currently going. Thus, determine what facing you want, what facing you
currently have, and what your current angular velocity is around the
facing axis. Then apply a torque proportional to how much you want to
turn, and inversely proportional to your current angular velocity in
that direction (to avoid overshoot). You will have to tweak the
weighting constants in this formula -- it turns out that this becomes a
The axis and reference frame you want here is world space, not object
space, btw.

For rolling, just add a bit of torque around the local "right" axis of
the object.

To avoid falling, you can also use a manual controller like that, if you
don't want to create a joint. Figure out how much you are leaning based
on some dot products between local and world axes, and apply a torque to
correct. Again, make sure to subtract out current angular velocity, and
avoid oscillation.

Cheers,

/ h+

Lucius Crenshaw wrote:
>
> Hi.
> I'm still in need of some serious help on model my rolling "coin".
>
> What I want is this:
> 1.) A "coin" /cylinder standing on its side.
> 2.) Some kind of motor making it roll.
> 3.) Be able to control the direction its rolling in. (the rotation
> around the global up-axis)
> 4.) It must not fall on it side, it have to be standing all the time.
>
> 1 and 2 isn't really a problem but 3 and 4 is.
> This is viewed form a top-down perspective and the coin is supposed to
> always roll towards the mouse pointer.
>
> How can an object like this be modelled in ode?
>
> Is there a joint like the hinge2 that can be attached to only one object?
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> ODE mailing list
> ODE at ode.org
> http://ode.org/mailman/listinfo/ode
```