Body.Dispose and Geom.Dispose

Nov 5, 2007 at 9:11 AM
Hi there.
Quick question. Lets say I have an object which contains one Body and one Geom object created by BodyFactory.Instance.Create...Body (PhysicsSimulator, ...) and GeomFactory.Instance.Create...Geom (PhysicsSimulator, ...). So at some time I found my object not needed anymore and I delete it from my objects list. But I think my Body and Geom objects will be still in PhysicsSimulator body/geom list. So I think I need to call Body.Dispose and Geom.Dispose to remove them from those lists. Am I correct? Does Body.Dispose and Geom.Dispose really removed them from body/geom PhysicsSimulator's list? Cause if no then GC will never get them which will cause memory leak.
Nov 5, 2007 at 4:43 PM
You can just call Body.Dispose. This will remove both the body and any connected Geometries from the simulator.