How to Disable Simulation on a Rigid Body

wbaldwin
Posts: 14
Joined: Mon Feb 23, 2009 9:01 am

How to Disable Simulation on a Rigid Body

Post by wbaldwin »

Lets say I have a rigidBody object A who's CF_NO_CONTACT_RESPONSE flag is set, and its struck by another rigidBody object B who's CF_NO_CONTACT_RESPONSE flag is not set. Does anyone know how I would be able to deactivate rigidBody A (so that it is not simulated)?

I had imagined that this would be possible by calling:

forceActivationState( DISABLE_SIMULATION );

but the simulation is not stopped and the object remains on the screen.

Thanks, and any help is greatly appreciated.
zzcn
Posts: 20
Joined: Tue Nov 04, 2008 1:50 pm

Re: How to Disable Simulation on a Rigid Body

Post by zzcn »

there is a setCollisionFlag function, maybe it's that one
wbaldwin
Posts: 14
Joined: Mon Feb 23, 2009 9:01 am

Re: How to Disable Simulation on a Rigid Body

Post by wbaldwin »

Thanks, but the setCollisionFlag function doesn't seem to work.

Here's what I'm trying to do: I have a shooting game, and whenever a bullet hits a character I want to be alerted through the bullet physics library. The moment it hits, however, I wish to remove the bullet from the world (as I no longer have any need for it).

I had imagined that this could be done by deactivating the bullet, but was unsuccessful. I also imagine this could be done by removing the bullet from the simulation world, but with possibly hundreds of bullets on the screen at a given time, constantly adding and removing bullets from the simulation world would severly slow down my application.
zzcn
Posts: 20
Joined: Tue Nov 04, 2008 1:50 pm

Re: How to Disable Simulation on a Rigid Body

Post by zzcn »

maybe remove it is a better way, if u just continually add bullet into the world but without removing it, that will just waste more or less some memory.
u can measure the calling time of "removeRigidBody" function, take a look how long it takes to remove a bullet object.
pico
Posts: 229
Joined: Sun Sep 30, 2007 7:58 am

Re: How to Disable Simulation on a Rigid Body

Post by pico »

Hi,

you can overwrite the needsResponse virtual function. There you can make a special test for the body you want to disable

regards