2014/07/18

Sleeping object in Bullet

Bullet again, I tried to apply force to an object (rigid body) which is hanged with a thread (btPoint2PointConstraint).
But it sometimes did not work. The object did not move at all after applying force. But the object was hit by other object, it moved and ‘apply force’ actually worked.

I found the answer that objects in Bullet ‘sleep’ after they are left for a while.
So you have to be careful to apply force in code (if the object are hit or moved by kinematic object or rigid body or something, there is no problem).

rigidBody->activate();
↑This makes the object get up!

rigidBody->applyImpulse(btVector3(fx,0,.0) , btVector3(x,y,z));
↑You can apply force like this after its wake up.

BOOL isActivate = body->isActive();
↑You can see its state in bool value.
Profile | Comments(1) | Trackback(0)
Comment
Comment is pending approval.
Comment is pending blog author's approval.

管理者のみに表示