Disable/remove body

Discuss any questions about BEPUphysics or problems encountered.
Post Reply
saturn1
Posts: 34
Joined: Thu Dec 24, 2009 11:14 pm

Disable/remove body

Post by saturn1 »

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.
Norbo
Site Admin
Posts: 4929
Joined: Tue Jul 04, 2006 4:45 am

Re: Disable/remove body

Post by Norbo »

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.
maybe there is a function like disableBody which is [less] expensive??
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.
saturn1
Posts: 34
Joined: Thu Dec 24, 2009 11:14 pm

Re: Disable/remove body

Post by saturn1 »

Thank you.
Post Reply