[ODE] UNSORTED TriList collision (no trees!)
Nate W
coding at natew.com
Thu Jun 19 02:09:01 2003
On Thu, 19 Jun 2003, Ed Resnick wrote:
> I don't quite understand the way ODE works, but how's this idea: After
> calling dCollide to find the contact points between a shape and the
> plane of the triangle, for each contact I check its position against
> the planes of the edges of each triangle. If it's outside any one of
> them, I don't create the contact joint for that contact. Is that
> right? When dCollide is called and writes the contact array, that
> array is the only location of the contacts; they're not internally
> stored, right?
I think that should work. My code throws away contact joint information
in between calls to dCollide and dCreateContact and it works as you'd
expect. If you don't call dCreateContact, the joint doesn't exist.
Considering that ODE lacks triangle-geom collider functions, you might
consider creating a few functions of the form:
CollideTriangleFoo (...)
{
CollidePlaneFoo (...)
ExcludeContactsOutsideTriangle (...)
}
And then submit the results as a contrib (I'd suggest calling it
'tri-collider' but that's already taken). There may be other people out
there who could use this family of functions, it seems to me like a good
thing to have.
I suggest reading these before you start, they'll give you a couple of
ideas on how to go about calling dCollidePlaneFoo:
http://www.q12.org/pipermail/ode/2003-May/008712.html
http://www.q12.org/pipermail/ode/2003-May/008727.html
http://www.q12.org/pipermail/ode/2003-May/008736.html
It would probably be possible to improve the above approach that by
finding ways to do some testing BEFORE calling the contact generator as
well, e.g.
CollideTriangleFoo (...)
{
if (TriangleFooIntersect (...))
{
CollidePlaneFoo (...)
ExcludeContactsOutsideTriangle (...)
}
}
Implementation of TriangleFooIntersect is left as an exercise for the
reader. I have a hunch that ODE's AABB and OBB stuff would come in handy
there, but I'm just guessing. In fact I'd feel a lot better about this
whole message if someone more familiar with ODE internals and/or collision
detection in general would step in to tell us we're not both smoking
crack.
--
Nate Waddoups
Redmond WA USA
http://www.natew.com