[ODE] more specific questions on physical movement of players..

Jon Watte hplus-ode at mindcontrol.org
Sun May 9 16:50:05 MST 2004


> 1) when I release the movement and strafe keys, my moving entity keeps 
> moving quite a bit. I think this is due to the fact that the sum of forces 
> acting on the body are greater than 0, and because my friction is not high 

I solve this with air drag, and fairly high friction. Air drag adds a force 
proportional to the velocity (or square of the velcity) in the anti-movement 
direction. High friction is, well, high friction :-) To avoid rolling, you 
want some rotational drag, too, which adds counter-torque proportional to 
angular velcity. I also clamp very small velocities to 0 (both linear and 
angular).

> 2) I have implemented a jump, which basically just calls this:
>    dBodyAddForce(bodyID, 0.0, 80.0, 0.0);
>   This works ok, but the problem is if the user holds down the jump key, the 
> force keeps getting applied, and the user quickly starts ascending. How can 
> I fix this?

I do exactly the same thing, except I only allow the jump key to be registered 
if I have a floor collision on that step. A floor collision is defined as 
something that collides with the bottom end of my player capsule, and has a 
normal that's no more than 45 degrees off straight-up.

Another thing that helps is to model the player as a capsule, and re-set the 
orientation of the capsule to upright every frame, not using torque, but 
using direct orientation setting. This is getting into the very anti-physical 
but works well, just like moving something out of collisions using position 
in addition to force :-)

Cheers,

			/ h+




More information about the ODE mailing list