Changing the CG of a shape using Compound shape

chucksspencer
Posts: 35
Joined: Wed Jun 25, 2008 2:52 pm

Changing the CG of a shape using Compound shape

Post by chucksspencer »

I'd like to be able to change the center of gravity of a shape. One solution I've seen for this is to add the shape to a compound shape (containing only the initial shape) and using the compound shape's child transformation to offset the CG.
That's how it seems to be done in the vehicle demo.

My question is: is it wise to do this a lot? Is it much more expensive to simulate a compound shape containing a single actor than it is to simulate that single actor independently?

- Chuck
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Changing the CG of a shape using Compound shape

Post by Erwin Coumans »

Yes, the btCompoundShape the most appropriate way to shift the center of mass. The performance isn't very different, and the overhead of the btCompoundShape is orders of magnitude smaller than the actual collision detection cost.

Thanks,
Erwin