Cleanly remove object from world

Spaddlewit
Posts: 28
Joined: Fri Sep 04, 2009 8:23 pm

Cleanly remove object from world

Post by Spaddlewit »

All I've been able to find in the demos is how to cleanly remove ALL objects from a world. What is the best practice if I just want to remove one? I have a pointer to both a CollisionShape and RigidBody.
User avatar
Erwin Coumans
Site Admin
Posts: 4221
Joined: Sun Jun 26, 2005 6:43 pm
Location: California, USA

Re: Cleanly remove object from world

Post by Erwin Coumans »

Removing all objects is just an iterative process of removing single objects. Have you tried removeRigidBody or removeCollisionObject?
(you need to keep track of collision shapes yourself, best to share them across objects when possible)

Hope this helps,
Erwin