Hello, for my game i use one quadtree and each time there is new body or removed body i do :
-World.Remove(this.Body);
-World.Add(this.Body);
But i wonder if it's a heavy operation, and maybe there is a function like disableBody which is more expensive??
Thank you.
Disable/remove body
Re: Disable/remove body
Adding objects to a space is pretty quick. Removing objects is still quick, but generally removals should be slower than adds. I couldn't say whether or not it is too expensive for your purposes; you'll have to measure and find out.
Dynamic objects that have been sitting still for a while will go to sleep. In a sleeping state, only the broad phase touches the entity. The other update processes early-out, making a bunch of sleeping objects quite cheap. Sleeping is handled automatically. You can check to see if an object is asleep using its entity.ActivityInformation.IsActive property.maybe there is a function like disableBody which is [less] expensive??