[ODE] more specific questions on physical movement of players..
Mike Reinstein
web_fella at hotmail.com
Sun May 9 20:40:34 MST 2004
Thanks for the help Jon:
I converted my code to use a capped cylinder rather than a sphere as such:
body = dBodyCreate(world);
geom = dCreateCCylinder(space, 10.0, 30.0);
dGeomSetBody(geom, body);
but when I run my code, it doesn't collide, and it falls through the floor
(the floor is a static trimesh). I seem to remember something about capped
cylinders not colliding with trimeshes about a month ago; do I need to
update my copy of ODE for a bugfix?
thanks man,
Mike
>From: "Jon Watte" <hplus-ode at mindcontrol.org>
>To: "Mike Reinstein"
<web_fella at hotmail.com>,<ode at q12.org>
>Subject: RE: [ODE] more specific questions on physical movement of
players..
>Date: Sun, 9 May 2004 16:50:05 -0700
>
>
> > 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+
>
_________________________________________________________________
Watch LIVE baseball games on your computer with MLB.TV, included with MSN
Premium!
http://join.msn.com/?page=features/mlb&pgmarket=en-us/go/onm00200439ave/direct/01/
More information about the ODE
mailing list