Stop simulating offscreen bodies
Posted: Sun Sep 04, 2011 6:30 am
Hi All
Im having a real problem with the FPS in my game dropping to about 15fps when running on a device.
I think the problem is that chipmunk is calculating all the physics/collisions etc for bodies that are outside of the viewable area. My game world is 13000 pixels wide and populated with lots of objects.
What I need to do is tell chipmunk not to do ANY physics calculations for objects that are offscreen (say 3 screen widths, so viewable screen + 1 screen size either side). I guess I would update the bodies to active in my tick function, but what Im struggling with is finding out how to tell chipmunk to not simulate them at all.
Any one got any suggestions?
Thanks
Oli
Im having a real problem with the FPS in my game dropping to about 15fps when running on a device.
I think the problem is that chipmunk is calculating all the physics/collisions etc for bodies that are outside of the viewable area. My game world is 13000 pixels wide and populated with lots of objects.
What I need to do is tell chipmunk not to do ANY physics calculations for objects that are offscreen (say 3 screen widths, so viewable screen + 1 screen size either side). I guess I would update the bodies to active in my tick function, but what Im struggling with is finding out how to tell chipmunk to not simulate them at all.
Any one got any suggestions?
Thanks
Oli