Bullet physics engine, how to freeze an object?

sunside picture sunside · Jun 10, 2010 · Viewed 13.6k times · Source

Using Bullet 2.76 I'm trying to freeze an object (rigid body) so that it instantly stops moving, but still responds to collisions.

I tried setting it's activation state to DISABLE_SIMULATION, but then it's virtually nonexistent to other objects. Furthermore, if objects "collide" with it when it's disabled, strange things begin to happen (object's falling through static bodies, etc.)

I suppose, temporarily converting it to a static rigid body could work, but is there an existing "native" way to achieve this on Bullet's side?

Edit: Is there a way to turn off gravity for a specific object?

Answer

Staffan picture Staffan · Jul 7, 2010

The documentation is a bit lacking but one would assume that the method below could be used to disable gravity on a specific body:

void btRigidBody::setGravity(const btVector3 &acceleration)