Hierarchical objects: compound shapes or constraints?

Andy La Rubin
Posts: 1
Joined: Mon Oct 01, 2012 12:26 pm

Hierarchical objects: compound shapes or constraints?

Post by Andy La Rubin »

Hi

We're starting to use Bullet for the new version of our game engine (http://ifhgame.ru), and here's some question on how should we proceed with the architecture:

We have hierarchical objects (meshes which have other meshes as children with relative positions/orientations from the parent mesh), so the question is - what is the most efficient way to implement it in Bullet? As I can see, there are three ways:
1) make a hierarchy of collision shapes using compound collision shape
2) make just one plain compound collision shape and make all other shapes as children of this shape
3) make all objects as separate rigid bodies and make hierarchy between them as fixed constraints

Can anyone advice on this?
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Hierarchical objects: compound shapes or constraints?

Post by Erwin Coumans »

Either 1 or 2 is good, using a btCompoundShape, using a flat hierarchy (2) is best for performance.

Try avoiding (3) using constraints, it will be slower and less stiff.

Thanks,
Erwin