Choosing the best CollisionShape for objects

Post Reply
nigul
Posts: 12
Joined: Tue Sep 22, 2009 1:40 pm

Choosing the best CollisionShape for objects

Post by nigul »

Hello,

General questions about CollisionShapes..

I want to generate CollisionShapes from Ogre Meshes (or Entities), and I'd like to handle this in the most generic way : what i'd like to avoid is to select "manually" in code the bullet CollisionShape that fits the Ogre mesh (a btSphereShape for a spherical mesh, a btBoxShape for a cube mesh, and so on...)

Actually, I use parts of code from OgreBullet wrapper to generate triangle lists from Ogre mesh, but I wonder which bullet CollisionShape is more suited to my needs.

From what I understood from Bullet :
btBvhTriangleMeshShape allows for nearly any kind of shape (even concave ones) but only for static objects;
btGImpactMeshShape allows for nearly any kind of shape (even concave ones), but one needs to register a coliision algorithm for using Gimpact.

I also guess that performance for convex/convex collision is better than for concave/concave collision.

the point is : if I know that the Ogre mesh is convex, should I use btConvexHullShape or btConvexTriangleMeshShape ?
is there any need to register collision algorithms as for btGImpactMeshShape ? Do those classes allow creation of dynamic bodies or only static ones ?

Thanks in advance

Nigul
User avatar
teravus
Posts: 12
Joined: Sat Sep 19, 2009 12:44 pm

Re: Choosing the best CollisionShape for objects

Post by teravus »

I can tell you that, yes, you do need to register the GImpact collision Algorithm to get GImpactShapes to work.

I can also tell you that yes, you can use dynamic bodies with GImpactMeshShape.

There is a performance penalty using GImpactMeshShape.. and a slight stability impact (simulation stability, conservation of energy, etc).

I suggest you use GImpactMeshShape only in places where the shape cannot be approximated by other means.
nigul
Posts: 12
Joined: Tue Sep 22, 2009 1:40 pm

Re: Choosing the best CollisionShape for objects

Post by nigul »

Ok, I've chosen btConvexHullShape and it approximates the meshes.

thanx !
Post Reply