[ODE] Box never stops bouncing

Roland Plüss roland at rptd.dnsalias.net
Sun Aug 27 10:31:51 MST 2006


after wrestling down the stepping issue with ODE i've tried now to get
for the first time a collision simulation done using Contact Joints. in
this case i simply made a box dropping from the sky under gravity. the
gravity velocity i add to the current object velocity during each frame
update ( hence before a simulation loop is done ). now for some reason
the box bounces around not coming to a rest and sometimes even jumps up
into the sky. any ideas what i did wrong?

i have:
    dWorldSetERP( pWorldID, 0.8f );
    dWorldSetCFM( pWorldID, 0.00001f );

simulaton step is 0.01 . each time the box collides with the ground i do
this:
   position = collider->GetPosition() + element->GetDirection() * timeToHit;
   contact.geom.pos[ 0 ] = position.x;
   contact.geom.pos[ 1 ] = position.y;
   contact.geom.pos[ 2 ] = position.z;
   contact.geom.pos[ 3 ] = 0.0f;
   contact.geom.normal[ 0 ] = normal.x;
   contact.geom.normal[ 1 ] = normal.y;
   contact.geom.normal[ 2 ] = normal.z;
   contact.geom.normal[ 3 ] = 0.0f;
   contact.geom.depth = -( element->GetDirection() * normal ) * ( 1.0f -
timeToHit );
   contact.geom.g1 = 0;
   contact.geom.g2 = 0;
   contact.surface.mode = 0;
   joint = dJointCreateContact( pWorldID, pJGContacts, &contact );
   dJointAttach( joint, odeCollider->GetBodyID(), 0 );

normal comes from my collision routine and is correct ( works without
ODE and direct collision response ). Direction contains the distance
travelled from this turn to the next. i rewind in the case of collision
to add the proper contacts and then doing the step again. i don't know
exactly how ODE handles the 'depth' value. ideas welcome.

-- 

Leader and Head Programmer
- Game: Epsylon ( http://epsylon.rptd.dnsalias.net/ )
- Game Engine: Drag(en)gine (
http://epsylon.rptd.dnsalias.net/dragengine.php )
- Normal Map Generator: DENormGen (
http://epsylon.rptd.dnsalias.net/denormgen.php )

-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 252 bytes
Desc: OpenPGP digital signature
Url : http://q12.org/pipermail/ode/attachments/20060827/3a59a04b/signature.bin


More information about the ODE mailing list