How to use Triangle Collision Detection?

Hello everybody,

i’ve tried to read the topic on new Triangle collision detection capabilites, and it seems very interesting since it’s more accurate than bounding.

However, what is exactly the method to use it ?

is declaring TriangleCollisionResult instead of BoundingCollisionResult and calling updateCollisionTree() in initGame is sufficient or we must make something else ?

Thanks in advance for help,


That’s about it…

The TriangleCollisionResult will contain the list of vertex indices for a the triangle(s) collided.

Just wondering how close the trangle ‘collision’ is to the trangle ‘picking’ that was discussed here:

Cep implemented an OBB tree for triangle accuracy. Then I tied it together with the bounding collision. So it’s quite different from that method (i.e. not brute force, and should be quite fast). Although, currently, there is a slight bug in Picking Triangle accuracy that causes it to pick up one or two triangles that is touching the actual picked triangle. This is a bug I introduced, and needs to be fixed.

Right now I can actually get the 3d spacial coordinate of the actual intersection of ray and triangle that is picked. Is that part of the OBB tree implementation?

Not inherently, but you obtain the three vector3fs that make up the triangle that was picked. At that point you can easily (and quickly, because you aren’t checking other triangles) find the point of intersection. That would be a good addition, and the place that it would fit is a new PickResults subclass. One that obtains the triangles that collided, (like TrianglePickResults), but instead of stopping there, gets the point of intersection.

I’ll take a look… after some gui stuff :D.

Maybe you can help me track down what I’m doing wrong to cause extra triangles (I’m sure it has to do with how I’m adding the indices to the collision list). Something obvious… but I’m too close to it to see it.

Any specifics would help. eg filenames, quick wording about what you believe you are doing… ya’ know.

TriMesh findTrianglePick(Ray toTest, ArrayList results) to OBBTree intersect(Ray toTest, ArrayList triList). My thoughts are the intersect method in OBBTree, because I altered it slightly, and I think I messed up:

if (toTest.intersect(tempVa, tempVb, tempVc))
                        triList.add(new Integer(tris[i].index));