Hi,
I am currently sharing a collision shape among different rigid bodies and it works well. In the meantime, I 'd like to have different scale but the scale is stored in the collision shape, so the Rbs have the same size.
Is there a way to have different scale with the same collision shape ?
Or would it be possible to copy an instance of a collision shape ?
Thanks
Vincent
Sharing btCollisionShape with different scale
-
slithEToves
- Posts: 24
- Joined: Mon Mar 12, 2007 9:55 pm
Re: Sharing btCollisionShape with different scale
You can use the btUniformScalingShape to accomplish this.
-
Erwin Coumans
- Site Admin
- Posts: 4221
- Joined: Sun Jun 26, 2005 6:43 pm
- Location: California, USA
Re: Sharing btCollisionShape with different scale
Bullet only supports _local_ scaling of collision shapes. Some other collision/physics engines allow for global scaling, as part of the world transform, but we decided to only support local scaling for some of the shapes. This simplifies some of the collision detection code, it allows extra optimizations.
Simple convex shapes (box/sphere/capsule/cylinder/convex hull) consume very little memory, so it is not really worth sharing those collision shapes with different scaling, but you could use the btUniformScalingShape to share instances among different rigid bodies, as the previous poster mentioned.
It makes more sense to share btBvhTriangleMeshShape of different scaling, and this can be done using the btScaledBvhTriangleMeshShape.
Hope this helps,
Erwin
Simple convex shapes (box/sphere/capsule/cylinder/convex hull) consume very little memory, so it is not really worth sharing those collision shapes with different scaling, but you could use the btUniformScalingShape to share instances among different rigid bodies, as the previous poster mentioned.
It makes more sense to share btBvhTriangleMeshShape of different scaling, and this can be done using the btScaledBvhTriangleMeshShape.
Hope this helps,
Erwin