Activate / passivate bodies

Official forum for the Chipmunk2D Physics Library.
Post Reply
MarkR
Posts: 3
Joined: Sun Nov 11, 2007 5:23 am
Contact:

Activate / passivate bodies

Post by MarkR »

Hi,

Suppose I have a large world with a lot of bodies in that the player can see only a small part of at any one time. I don't want Chipmunk wasting cycles simulating things happening (or indeed, not happening) a long distance away (especially as those bodies are probably not moving).

Is there a simple way I can make a body passive - stop it taking part in cpSpaceStep until later, then I can reactivate it before the player notices?

Will simply removing the body from the space do, or do the shapes need to be removed as well? If I remove them all, when I add them back is everything expected to work (assuming I keep other references to them in some other structure).

The same is true of static shapes - if I have, say 10,000 static shapes most of which are nowhere near anything going on, is it reasonable to remove them and add them back once they're in play?

Mark
Post Reply

Who is online

Users browsing this forum: Heise IT-Markt [Crawler] and 18 guests