[ODE] collision detection/response without using ODE's collision engine

nlin@nlin.net nlin at nlin.net
Mon Jun 24 05:04:01 2002


SkeedaddIer@aol.com wrote:

>     Ken - I tried to setting depth to (sphere.z-sphere.radius) since it would 
> equal the penetration depth of the sphere against the plane at 0.0f. The 
> spheres still pass right thru the plane, no bouncy collision response.
> 
>     Figured it would help if you or anyone could look over the code and 
> figure out why i'm not getting the right results, so I posted it at:
> 
>     www.qlink.org/test_boxstack.txt
> 
>     Hope someone can fix this, i'm at wits end trying to figure out the 
> basics so I can build on from there. Thanks in advance!

I got your code to work. You should:

0) Copy your contact.geom.pos and contact.geom.normal arrays element-by-element
and not attempt to assign non-lvalues. My compiler (gcc) wouldn't even compile
your assignments "contact.geom = contactposition". You might be using a
non-standards-compliant C++ compiler such as the one from Redmond.

1) Change gravity to be 0,0,-0.0005. With your current -9.81 value the spheres
are falling too quickly and this can conceivably cause problems when resolving
penetrations (since if the sphere moves more than its diameter in one timestep,
the formula used in the code won't work for computing the penetration)

2) Attach the joint NOT between the body and the ground plane, but instead
between the body and NULL. This is because the ground plane is immovable
with infinite mass. You create a ground plane body with dBodyCreate, but
you never assign it any mass parameters. You want it to have infinite mass,
so you don't need to create any body at all for the plane, just the
Geom.

Now, if only I could get that triangle-collider to work....

-Norman