Take the 2-minute tour ×

I know it breaks physics laws, but although there are often practical reasons to change instantaneously the position and orientation of a body in a game, most physic simulation libraries won't allow it, so Bullet Physics won't either.

So, I'd appreciate any suggestion or comment on this one.

By the way, teleportation comes to mind that requires those instant changes. Also a more exotic application could be inertia - for instance when tilting or rotating a portable device with accelerometer, so that objects would appear to be static in relation to the user. Augmented reality shouldn't sound cheesy.

share|improve this question
add comment

1 Answer

up vote 0 down vote accepted

Assuming that I understand your question correctly, I'd recommend checking out BulletDynamics/Character/btCharacterControllerInterface.h and/or BulletDynamics/Dynamics/btActionInterface.h. Oftentimes one wants to "bend the rules" when implementing character movement - to implement teleporting, for example, one could use the void warp(const btVector3& origin) method from btCharacterControllerInterface.

Personally, I've had the best luck inheriting directly from btActionInterface, storing a pointer to a btGhostObject that I can update and implementing my logic from there, but YMMV.

Note: If you're just wanting to change the position and orientation, you should be able to call the void setWorldTransform(const btTransform& worldTrans) method for btRigidBody.

share|improve this answer
Does setWorldTransform change the physical body position and rotation too, or only the "skin" or graphical representation? –  rraallvv Nov 23 '12 at 21:33
Actually, the call to setWorldTransform should only update the physics portion - updating the graphical representation is up to you, though fairly simple to do. (: –  Jeremy Sandell Nov 26 '12 at 5:06
add comment

Your Answer


