[Solved] Restarting scene / physics within working game

Restarting scene within working game
When I run the code it:
bulletAppState = new BulletAppState();

during loop:
checks whether game map (own file with coords, values, etc) is loaded. If not, then looks


Still is Ok. When the player dying code asks - continue ( works good) or restart… Yup… this is this moment…
I am doing restart:

bulletAppState.getPhysicsSpace().destroy(); bulletAppState.getPhysicsSpace().create();
cleanUp all of arrayLists with enemies, consumables, items etc.
initMapLoading(); // the same file loads again

Result is the map is loading again as previously but every physics wraped models are invisible despite in physics space they are ( in debug mode )

How it should be properly done ?

Remove each item by referencing their PhysicsControl. I’ve never called physicsSpace.destroy() and I don’t think it’s best practice to do so. I’ve always removed them individually by reference.

Hmm… it does not difference. What I have noticed that rigidBody Controlled items seems to be OK. works and are displayed but BetterCharacterControled are not. Have I to restart the Controllers or something ?

It’s almost impossible to tell without code. Off the top of my head you may be referencing the old physicsSpace that you destroyed when you add the character controls again. I have no idea without code tbh.

I’ve never used PhysicsSpace.destroy(). If you still need a PhysicsSpace, and it’s got the right broadphase and everything, why not just empty out the existing PhysicsSpace (remove every joint, rigid body, character, and ghost) and then re-use it?

The source of all problems was naming and referencing to nodes. It could be a common problem if use own file but not native scene j3o with embeded scene structure. Name of model was differ to the one in rootNode tree and it caused problems with removing of single node. That was overall error in code. Referencing to name used in code did not effect to rootNode… unfortunately name for physic space was correct what additionaly complcated problem finding.