Hi all, I’m using Physics Editor for creating some complex objects. So, at the top of my StoryBoard scene, I require the data as an external module, like this:
local physicsData = (require "shapedef4").physicsData(1.0)
Where shapedef4 is the lua file and physicsData is it’s table, containing various physics bodies, bits and masks.
After a gameOver event (the scene swaps back to the main menu) I have an interim scene that removes the main game scene via storyboard.removeScene(“gameScene”).
The problem I seem to be having, is everytime I re-enter the gameScene, the physics bodies (that don’t seem to have been removed in the first place) keep reloading on top of each other, so the more I re-enter the gameScene the more the game slows down.
I’ve tried every method I can think of to destroy the scene, including removing the bodies (and their listeners) manually, deactivating the bodies and even tried unloading the external module (which isn’t included as a storyboard asset. So, like this:
package.loaded["shapedef4"] = nil
I must be missing something… The physics bodies aren’t hanging around when I swap to ‘menu’, but they still appear to be in the gameScene after I re-enter.
This one’s really killing me. Any idea?