Create several rigid bodies that are disabled at the start

Digitalghost
Posts: 25
Joined: Thu Dec 20, 2007 4:03 am

Create several rigid bodies that are disabled at the start

Post by Digitalghost »

Hey all,

I would like to replace a static graphical model with a physics-based representation at runtime based on context (i.e., if the player is going to run into a wall, replace the static geometry with a physics wall made of bricks).

The key is that I do not want the rigid bodies to be activated unless the player or something else makes contact. Otherwise, the wall will crumble before the player collides with it. How can I create rigid bodies that are initially deactivated? Can I simply set the deactivation time? If I create several bodies and they overlap slightly, will that cause them to collide and become activated on the next update loop?

Thanks for your help.
mp-nico
Posts: 5
Joined: Mon Feb 23, 2009 10:20 am

Re: Create several rigid bodies that are disabled at the start

Post by mp-nico »

Is ...

btRigidBody::setActivationState( ISLAND_SLEEPING );

.. what you are looking for?
Digitalghost
Posts: 25
Joined: Thu Dec 20, 2007 4:03 am

Re: Create several rigid bodies that are disabled at the start

Post by Digitalghost »

mp-nico wrote:Is ...

btRigidBody::setActivationState( ISLAND_SLEEPING );

.. what you are looking for?
My concern is that the rigid bodies are brand new, so I don't know if they are even part of islands at this point.

I'll try setting that and see what happens.

I suppose if worst comes to worst, I could run the physics update loop one time and then set them to sleep.