Deleting an object

Mar 4, 2009 at 10:58 AM
Just a simple question is there any way to delete an body and geom when they have been added to the physic engin
Mar 4, 2009 at 12:54 PM
Indeed there is.

Use PhysicsSimulator.Remove() or call .Dispose() on the geom/body.
Remember that bodies and geometries is not removed right away when you use PhysicsSimulator.Remove(). They are removed on the next physics update.
Mar 4, 2009 at 3:35 PM
Ah thx that will help alot! one more thing is there away to overide a body and geom with another body and geom? really apricate all the help!
Mar 4, 2009 at 5:37 PM
You can exchange geometries on the fly by creating a new geometry with the same body. You can also do it the other way around.
The Geom class has a reference to the body class. (Geom.Body) but not the other way around. (No Body.Geom).

You can also make two geometries use the same body if you want to.