Game Development Stack Exchange is a question and answer site for professional and independent game developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm beginning Bullet3D. Can I change collision shape of a rigid body after it created? A rigid body accepts a collision shape when it's creating, but it's hard to find options changes the collision shape of an instance.

share|improve this question
up vote 4 down vote accepted

There are setCollisionShape() and setMassProps() method for this on btRigidBody class.

share|improve this answer
setCollisionShape doesn't appear in the documentation, except in a code snippet as a private method -- is the documentation out of date or just missing that method? – Josh Petrie May 5 '11 at 15:30
@Josh This is completely my guessing. I don't think the BulletPhysics have well reference document. (except user guide) Because there are some mismatch points in doc against real code, and there're many people complaining about its doc quality. And even the author confirmed it. It's obvious the doc is not syncing with recent code. IMHO, the author does not care about documentation so much. So I just followed the rule "Source is the documentation" as like many open-source projects. I don't like this kind of hacking, but I believe that the author may don't have enough time to manage to doc. – Eonil Jun 7 '11 at 16:40

As far as I know, you can't. You'd have swap out the entire rigid body object, I would imagine.

share|improve this answer

Here is how I've been able to do it:

  1. Remove the rigidbody from the world.
  2. Destroy the old shape(not sure if this is needed, but I do it for safe measure).
  3. Create the newShape.
  4. Use rigidbody.setCollisionShape(newShape). It is on the btRigidbody but is not in the API because it is an inherited from btCollisionObject.
  5. newShape.calculateLocalInertia(mass, inertia).
  6. rigidbody.setMassProps(mass, inertia).
  7. rigidbody.updateInertiaTensor().
  8. re-add the rigidbody to the world.

Depending on if your object is kinematic or has 0 mass, you might not need to do all the steps above, but I included them just in case.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.