Hi Forum !
So am currently working on a game and i have this problem. I am trying to make a scrolling. First let me explain how i setup my levels.
I first execute a loop to create static boxes. I create 50x50 static boxes of 32x32 pixels. Then i create level parts from these, level parts are
created with 8x8 static boxes. Once i scroll the camera around so that one level part is too far enough and should be removed i get all the parts that must be removed (3) since the camera height is a little less then 3 level part, i get those and loop trough each objects to destroy them. And then i do the same thing with the row to add to create the objects.
Here's the problem, when i scroll over and i create 3 parts and delete 3 parts its too process intensive and the game freezes. In had implemented this in other game but it was fine because visuals where hidden only data was left. With box2d it seems you cannot "remove and object" you can only destroy it or create it, this is in my opinion whats slowing the game down. Those anyone know what i could do to make this possible ? I doubt setting the awake property of the body to false would fix it as they are still in the list that loops to see if it has collision to do and what not. If i could give the world object a body that's already been created by it, it would solve the situation and also remove a body object without destroying it. I've also thought about doing this over multiple frames but i would want to setup the creation and destruction of objects correctly first.
Thank you for any help 🙂

for the visuals.
So am currently working on a game and i have this problem. I am trying to make a scrolling. First let me explain how i setup my levels.
I first execute a loop to create static boxes. I create 50x50 static boxes of 32x32 pixels. Then i create level parts from these, level parts are
created with 8x8 static boxes. Once i scroll the camera around so that one level part is too far enough and should be removed i get all the parts that must be removed (3) since the camera height is a little less then 3 level part, i get those and loop trough each objects to destroy them. And then i do the same thing with the row to add to create the objects.
Here's the problem, when i scroll over and i create 3 parts and delete 3 parts its too process intensive and the game freezes. In had implemented this in other game but it was fine because visuals where hidden only data was left. With box2d it seems you cannot "remove and object" you can only destroy it or create it, this is in my opinion whats slowing the game down. Those anyone know what i could do to make this possible ? I doubt setting the awake property of the body to false would fix it as they are still in the list that loops to see if it has collision to do and what not. If i could give the world object a body that's already been created by it, it would solve the situation and also remove a body object without destroying it. I've also thought about doing this over multiple frames but i would want to setup the creation and destruction of objects correctly first.
Thank you for any help 🙂

for the visuals.