Page 1 of 1

Temporarily disabling a RigidBody

Posted: Wed Apr 29, 2009 11:55 pm
by nikki
Hey guys!

For my next game, I'll be having a 'dimension' idea. Basically, there are two or more parallel worlds, and you can switch between them. The worlds are mostly the same, except there are a few differences, such as a wall in dimension 1 might not exist in dimension 2, and a switch might work in 2 while not in 1, and so on. The way I'll be handling this is having a property for each 'GameObject' (logic objects in my system) that shows which dimension it belongs to, and the GameObject accordingly makes itself known depending upon the global dimension.

What I was looking for was a way to 'temporarily disable' a RigidBody, that is, no collision events, no physics handling (the object is 'there' but other objects don't collide with it) etc. without destroying it.

Re: Temporarily disabling a RigidBody

Posted: Thu Apr 30, 2009 5:22 am
by jcrada

I would try

Code: Select all

but I think that you have do the same to all the other rigid bodies it is connected to. I think that is called an island, so you must disable the whole island.

DISABLE_SIMULATION is defined in btCollisionObject.

Re: Temporarily disabling a RigidBody

Posted: Thu Apr 30, 2009 10:41 am
by nikki
Actually, after a little bit of though, I found that the actual way it should work would be that objects could continue to collide with objects in their dimension, and objects in both dimensions are affected by objects in both. I was able to get the effect I desired using collision filter masks.

Now, I have another question: Is it possible to change this mask after an object is created? It's required for the Player.

EDIT: I found a way: removeRigidBody and addRigidBody with the new dimension. Is this the right way to do it?