[ODE] Box-mesh collision

Pierre Terdiman p.terdiman at wanadoo.fr
Sat Nov 23 08:12:01 2002


Hi,

I was (finally) looking at Erwin's box-mesh collision today, when I noticed
something weird :

    float DistSq = ColTri.Plane.Normal.DotProduct(BoxCenter -
*ColTri.Vertices[0]);
    ColTri.ClosestPoint = BoxCenter - (ColTri.Plane.Normal * ColTri.DistSq);

Unless I'm missing something, the local variable DistSq is never used. On
the other hand, ColTri.DistSq is used while probably not initialized. I
guess the two lines should be :

    ColTri.DistSq = ColTri.Plane.Normal.DotProduct(BoxCenter -
*ColTri.Vertices[0]);
    ColTri.ClosestPoint = BoxCenter - (ColTri.Plane.Normal * ColTri.DistSq);

...unless, once again, I'm missing something. (I didn't trace it, I'm just
browsing the CVS repository)

There's also another version from Nolan Walker, based on Magic. Is this
better / more recent ? (the question might already have been asked, but I
can't remember the answer...)

Pierre