Teleporting a rigid body

CaptainNemo
Posts: 9
Joined: Fri Aug 18, 2006 7:24 pm

Teleporting a rigid body

Post by CaptainNemo »

Is there a proper way for teleporting a dynamic rigid body? I sometimes have the need to force the position of a body, and often they receive outrageous speeds after such a teleport. Forcing the velocity to 0 did not help, and I can't make it a kinematic body, as you suggested in another post. So is there some way to reset a body to its initial state?
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Post by Erwin Coumans »

Teleporting can easiest be done by removing the rigidbody from the dynamics world, setting the new position, and adding it back to the world.

Alternatively, you can check how to clear contact points, when teleporting a rigidbody, in Bullet/Demos/OpenGL/DemoApplication.cpp

Code: Select all

void    DemoApplication::clientResetScene()
Hope this helps,
Erwin
CaptainNemo
Posts: 9
Joined: Fri Aug 18, 2006 7:24 pm

Post by CaptainNemo »

Thanks, Erwin, I'll try that.