First of all I must say thank you for such a great tool, but "saddly" i have a small problem... i hope:)
Platform: iphone and cocos2d.
I have cca 200 static bodies that have same velocity and one dynamic body. Static bodies are entering and than leaving the screen(play area). Imagine a a game where you are flying through a cave with stones as obstacles.
In my first attempt i was creating "world->CreateBody()" obstacles before they entered on screen and than destroy "world->DestroyBody()" them. The problem was that the game randomly started to jiggling (FPS dropped from 60 to 20,30) for a second or two. Here i suspect garbage collector. It happened more often when there were more (around 20 obstacles) on the screen.
Than i tried creating all the obstacles at the beginning of the level and put them to sleep SetAwake(NO). Right before they enter to the screen i wake them up. The results were better, jiggling almost dissapered, but FPS drops to 30,40. I have also tried to use SetActive() method. FPS was better, but the jiggling come back and to occured more often than in previous try(SetAwake()).
Now the questions are: Which solution do you recommend? What is the proper/faster way for adding and removing objects? What is the key difference between awake and sleep flag. And do you have anyideas how could i improve performances?
Thank you.
Platform: iphone and cocos2d.
I have cca 200 static bodies that have same velocity and one dynamic body. Static bodies are entering and than leaving the screen(play area). Imagine a a game where you are flying through a cave with stones as obstacles.
In my first attempt i was creating "world->CreateBody()" obstacles before they entered on screen and than destroy "world->DestroyBody()" them. The problem was that the game randomly started to jiggling (FPS dropped from 60 to 20,30) for a second or two. Here i suspect garbage collector. It happened more often when there were more (around 20 obstacles) on the screen.
Than i tried creating all the obstacles at the beginning of the level and put them to sleep SetAwake(NO). Right before they enter to the screen i wake them up. The results were better, jiggling almost dissapered, but FPS drops to 30,40. I have also tried to use SetActive() method. FPS was better, but the jiggling come back and to occured more often than in previous try(SetAwake()).
Now the questions are: Which solution do you recommend? What is the proper/faster way for adding and removing objects? What is the key difference between awake and sleep flag. And do you have anyideas how could i improve performances?
Thank you.