# Advantage of collision geometry over normal geometry

Hello,

I have read about an advantage of using dedicated collision geometry over the use of the existing visible geometry in terms of performance. But I would like to know how much it actually yields. And is it valid in all cases, as creating extra geometry also raises extra costs?

For instance in my SkyCraft project, I create individual 2-triangle tristrips for every face at the border between a cube and air. Is there an improvement in collision detection performance with creating a collision polygon and does it justify the creation of an extra node and/or geometry, though invisible?

I know I could just test it, but that would not answer the general question of collision cost savings. Is there a factor or range?

Thanks for your information an experiences,

Michael

Hi

I really don’t know all that much about this area to be honest, but I believe the main advantage of having separate collision geometry is in having simpler collision geometry than visible geometry. Often collisions don’t have to be perfect in respect to visible geometry, so having a low-poly collision model is cheaper to compute while giving nearly the same result. Idealy of course you’d be using spheres for collision, distance being comparatively cheap.

I believe using visible geometry as collision geometry treats it all as polygons (though I could very well be wrong), in which case your method would only create overhead.

After a short look into the manual, it also says two more things that may be of note:

1. Collision detection into visible geometry uses all the geometry. Using collision geometry can reduce unneeded computation by specifying more what can be collided into.
2. Collisions into polygons is expensive and not always reliable. It also says you should be using quads and not triangles if possible (not sure if that’s what you’re doing with the tristrips).

Anyway, hope this helps

Hi,

Yes, I have read this passage and to be exact, the tristrip creates 2 triangles while I could create 1 quad object because the face is always planar. So it would be 2 items (tris) against 1 additional item (quad), though I don’t know whether a quad takes exactly half the calculation time of two triangles.

BR,
Michael

Collision geometry is far, far cheaper than visible geometry. Although it is true that simpler geometry is faster still, collision geometry would be about 100 times faster even if you exactly duplicated your visible geometry 1:1 in the scene graph.

This is because the code path that supports visible geometry has to do it by creating a CollisionPolygon on the fly–each frame!–for each visible triangle in your mesh.

This is necessary because the visible triangles don’t store all of the data that is needed for the collision system to work, like the plane equation of the polygon.

Visible geometry as collision data was always intended as a quick hack to get something to work when you just need something now. It should not be considered a viable long-term solution.

David

Hi David,

many thanks, that really helps a lot!!

BR,
Michael