disable calculations on offscreen cpbody?
Posted: Mon Mar 22, 2010 5:46 pm
Hi,
I have a game that i'm optimizing performance on. I'm using the latest chipmunk (5.x) and cocos2d on the iphone. the question has to do with the chipmunk side.
I recycle my sprites. So I have a spriteFactory that makes - let's say - 6 sprites. Upon collision (with a bullet), i've chosen not to destroy the sprites (and associated cpShape/cpBody) so I can use them again without having to remanufacture them.
The technique I use in the collision callback is to simply place the collided sprite offscreen at some point far, far, away. Immediately after that is done, the sprite is reset and gets back onscreen.
So... all's well...
BUT...
I am worried that when i banish a sprite temporarily to that far away point, that chipmunk is still calculating stuff on it. And that is compounded if 2 sprites are banished to overlapping points.
My question is: is there a way I can temporarily disable calaculations on a cpBody/shape and resume the claculation once it's position is reset? that might gain me some frames per second.
thanks
m0by
I have a game that i'm optimizing performance on. I'm using the latest chipmunk (5.x) and cocos2d on the iphone. the question has to do with the chipmunk side.
I recycle my sprites. So I have a spriteFactory that makes - let's say - 6 sprites. Upon collision (with a bullet), i've chosen not to destroy the sprites (and associated cpShape/cpBody) so I can use them again without having to remanufacture them.
The technique I use in the collision callback is to simply place the collided sprite offscreen at some point far, far, away. Immediately after that is done, the sprite is reset and gets back onscreen.
So... all's well...
BUT...
I am worried that when i banish a sprite temporarily to that far away point, that chipmunk is still calculating stuff on it. And that is compounded if 2 sprites are banished to overlapping points.
My question is: is there a way I can temporarily disable calaculations on a cpBody/shape and resume the claculation once it's position is reset? that might gain me some frames per second.
thanks
m0by