[ODE] Player control

Jon Watte hplus-ode at mindcontrol.org
Fri Sep 17 09:37:37 MST 2004


> Has anyone ever done this? Anyone know how other games do it?

Isn't this in the FAQ? Typical is to use a ccylinder turned 
on its end so the cap is down (feet). Set the friction for this 
ccylinder to 0, or something very small. Apply both linear and 
angular dampening based on linear/angular velocity, every step.

> Another question: How do I find out if the player is on the ground? Is 
> it sufficient to create some rays under the player and check if they 
> intersect the world?

Most people look at contacts added to the player body, and if 
any of the contacts have a normal that's mostly up, and the 
contact point is below the pelvis of the character, then that 
counts as ground contact. You get this for free inside your 
collision callback, without casting rays.

Other people use a ccylinder (or sphere) that floats above 
ground, with a ray down to the ground, and simulate a spring 
to keep the pelvis a certain amount above ground (and use IK 
to plant feet). This may make crouching easier, but also may 
mean you're penetrating between, say, left leg and a rock.

If your world simulation doesn't yet allow customization of 
bodies and the joints/forces added to them (through a callback 
in the collision, say), then you are probably going to need to 
add that to stay sane :-)

Cheers,

			/ h+




More information about the ODE mailing list