Updating a rigidBody collision shape

sipickles
Posts: 44
Joined: Thu Aug 07, 2008 6:57 am

Updating a rigidBody collision shape

Post by sipickles »

Hi,

At present, my rigidBodies are getting info on the collision shape to use in their constructor, using rigidBodyConstructionInfo.

Is there any way to update the size of the collision shape after construction? I don't really want to have to delete and recreate the whole object.

Basically I am looking to modify the boundingBox size based on a mesh. I don't know the size of the mesh until after the mesh has loaded, which is after the creation of the rigidBody. Rigid bodies are set a default bounding box size, which I want to update when the info becomes available.

Many thanks!

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

Re: Updating a rigidBody collision shape

Post by Erwin Coumans »

Please try this:

1) remove the rigid body from the dynamics world
2) change the collision shape using 'setCollisionShape'.
3) add the rigid body back into the dynamics world

Hope this helps,
Erwin
sipickles
Posts: 44
Joined: Thu Aug 07, 2008 6:57 am

Re: Updating a rigidBody collision shape

Post by sipickles »

Hi Erwin,

Thanks, this is what I have done.

It is not perfect for my app, but not bad. I just hoped there might be a 'live' mutator....

Any hey it works!

One question, how does the XYZ coords of bullet relate to the XYZ of directX? I have noticed a few bounding box anomalies.

Thanks
Si