I had a strange problem with my collisions resulting in somewhat drastic correcting forces (read: explosions) and eventually tracked it down to the trimesh data I was using for collision geometry.
OpenGL requires parallel arrays of vertices and texture coordinates (if you use glDrawElements). This means that if two faces use a vertex but have different texture coords at the point, you need to duplicate the vertex in the array so that each element can have its own tex coord (AFAIK). This means a cube could potentially have 24 vertices.
The problem is, when I feed this array of vertices and indices to Bullet/GImpact, it seems that having multiple vertices in one point messes things up resulting in explosions. Am I correct in assuming that this is the problem, and is there a way to correct for it without maintaining a separate copy of my geometry?
Thanks
Trimesh-Trimesh with multiple verts in one place
-
- Posts: 7
- Joined: Fri May 16, 2008 8:01 am
-
- Posts: 109
- Joined: Thu Dec 14, 2006 4:27 pm
- Location: Colombia
Re: Trimesh-Trimesh with multiple verts in one place
Bullet/GImpact handles the case when having multiple vertices in one point. It just merges the contact points to no more than 4.
May the problem remains because there are some triangle normals that coldn't get normalized (with a near zero magnitude). Problems raise when you get triangles like: without area, overlapped , or triangles which vertices aren't properly ordered.
In collision detection, you need to set the triangle meshes carefully. Is better to have triangles with an uniform squared size, not too big but also not too small.
May the problem remains because there are some triangle normals that coldn't get normalized (with a near zero magnitude). Problems raise when you get triangles like: without area, overlapped , or triangles which vertices aren't properly ordered.
In collision detection, you need to set the triangle meshes carefully. Is better to have triangles with an uniform squared size, not too big but also not too small.