Terrain Collision Holes

Mjohnsonii
Posts: 7
Joined: Tue Dec 09, 2008 7:41 pm

Terrain Collision Holes

Post by Mjohnsonii »

Greetings,

We are currently using the btHeightfieldTerrainShape and it has been working very well. We have a requirement for specific terrain quads/triangles to be ignored during the collision detection process with the purpose of having holes in the terrain that dynamic collision objects could fall through and onto a separate collision mesh below.

Is there a method to flag specific terrain quads/triangles so that they will be ignored?

We like the convenience of using the btHeightfieldTerrainShape class but I suppose we could manually construct the mesh using a btTriangleMesh and feed it into a btBvhTriangleMeshShape. Are there any performance implications of using btBvhTriangleMeshShape over btHeightfieldTerrainShape?
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Terrain Collision Holes

Post by Erwin Coumans »

You can derive your own class from btHeightfieldTerrainShape and override the 'processAllTriangles' method and filter out the triangles/holes.

See also the discussion here:
http://www.bulletphysics.com/Bullet/php ... %2A#p11691
What goes for the holes they are real holes. I'm using a bit-array to declare if a face is visible or not. The final rendered mesh then omits those triangles ( it's done using indexing and a personal variation of CLOD ). In bullet I used my own class where in the process triangles method I also checked triangles for visibility using the same bit-array. Works splendid so far.
Hope this helps,
Erwin
Mjohnsonii
Posts: 7
Joined: Tue Dec 09, 2008 7:41 pm

Re: Terrain Collision Holes

Post by Mjohnsonii »

I saw that thread during a search but somehow I missed that post. Thank you for the direction.