Triangle mesh - triangle mesh collision

Tau
Posts: 25
Joined: Tue May 01, 2012 11:52 am

Triangle mesh - triangle mesh collision

Post by Tau »

Hi,
for a while i finished my first DX9 game. After starting programming my second game, with more experience, i learned how to load dx meshes into btBvhTriangleMeshShape. So i wanted to improve first game and create btBvhTriangleMeshShape for all building, npc and player model. But player - environment collision did not work. For map i use btHeightfieldTerrainShape. When i changed player shape back to sphere like it was before, it worked again even with building btBvhTriangleMeshShape.

Question is: Why did triangle mesh - triangle mesh collision not work and is it possible to make it work?
Mako_energy02
Posts: 171
Joined: Sun Jan 17, 2010 4:47 am

Re: Triangle mesh - triangle mesh collision

Post by Mako_energy02 »

btBvhTriangleMeshShape is a shape intended for static objects only, and doesn't support collisions with itself(as static objects aren't supposed to collide with other static objects). To get around this you either need to set up your application to use GImpact(in the Bullet extras folder) and use that for your model if you REALLY, REALLY need your player model to be simulated with a triangle mesh, or you could use a sphere/cylinder and get decent framerates. There is a considerable performance hit when using GImpact. You could also use a compound shape as long as you keep it reasonable.
Tau
Posts: 25
Joined: Tue May 01, 2012 11:52 am

Re: Triangle mesh - triangle mesh collision

Post by Tau »

Mako_energy02 wrote:btBvhTriangleMeshShape is a shape intended for static objects only, and doesn't support collisions with itself
Thanks, this helped. I noticed GImpact in App_MovingConcaveDemo, i try to implement it.
It is a one-man-submarine game, i used spheres but on some models sphere does not fit the entire model, sometimes models collide with map even if there is still space between and parts of different models can go through map.