[ODE] Player's Avatar Motion

Megan Fox shalinor at gmail.com
Thu Jun 8 08:48:37 MST 2006

The locked orientation via setting the quaternion in per-frame (which
you've got to do per time-step, mind you, you can't get away with
setting it outside of your per-timestep looped code) works really,
really well, but you've got to use dBodySetAngularVelocity and
dBodySetTorque to zero out any torque forces.  If you don't, they pile
up, and you get some really strange behavior (especially when touching
other objects).

I would suggest you consider using a ray cast straight down rather
than an actual geom, though.  A sphere "butt" will have a very hard
time traversing irregular surfaces like stairs, generally speaking,
whereas a float ray has nothing whatsoever to impede motion.

Treat the ray like a dampened spring, but only dampen in one
direction.  The trick I found is to use gravity as the MAX dampening
force, but calculate the amount of dampening required to null any
upwards motion first and, if that's less than gravity, apply only a
fraction of gravity (or apply a reverse-gravity force to cancel some
gravity out).  That with a carefully-balanced max up force (and some
code that applies a force to null any and all downwards motion once
the 'feet' ray touches ground), and you've got a very stable system.

If you're clever about it, a ray system can even be tied to leg IK for
some cool knee-bending-on-landing effects, since it isn't a hard
constraint.  You can even reduce the ray length to simulate "my
backpack is far too heavy."

On 6/8/06, Joshua Hayes-Sheen <grevian at gmail.com> wrote:
> have a look here:
> http://www.ogre3d.org/wiki/index.php/OgreOde_Walking_Character
> It's actually for OgreOde, the ode bindings for the Ogre3d engine, but
> it displays and explains a popular concept for avatar motion, and has a
> lot of code that should port to straight ode pretty easily.
> Ecker, Bryan R wrote:
> >
> > Hello experts,
> >
> > I just found ODE very recently, and I've been working with it a lot –
> > and so far, I've integrated it into a simple game engine demo that I
> > was working on for the purposes of learning ODE and refreshing my OSG
> > knowledge.
> >
> > Anyway, I'm a complete noob at this, and although it's very intuitive,
> > and straightforward in a lot of ways, I've run into a snag, and I'm
> > not entirely sure where to begin looking for a solution.
> >
> > What I've done is made a simple demo arena - a 100m square room with
> > 10m high walls (although in reality, the walls are infinite planes, as
> > is the ground). The "player" is currently represented by a 1 by 1 by 2
> > cube which is supposed to represent the player's avatar bounding box.
> >
> > The player, obviously, is supposed to move around the arena based on
> > user input. I've achieved motion by applying force to the user in the
> > direction I want it to go, but the box topples over, and rolls around
> > as if someone were pushing the box, instead of moving around of its
> > own volition, with a sense of balance. Also it ricochets off the walls
> > (often to an upward angle) instead of coming to a stop, like a game
> > character would.
> >
> > Actually, this behavior is quite expected, and looks very natural (if
> > you imagine someone there who's applying force to the box) - but it's
> > not what I want. How would one go about simulating self-propulsion -
> > either a player walking/running/jumping, or a car driving, or
> > something like that?
> >
> > I hope this isn't too stupid a question, but I've found no beginner
> > tutorials for ODE, and I'm having trouble coming up with a solution
> > that works.
> >
> > ~BRE
> >
> > ------------------------------------------------------------------------
> >
> > _______________________________________________
> > ODE mailing list
> > ODE at q12.org
> > http://q12.org/mailman/listinfo/ode
> >
> _______________________________________________
> ODE mailing list
> ODE at q12.org
> http://q12.org/mailman/listinfo/ode

-Megan Fox
Idyllon, LLC

More information about the ODE mailing list