Problems reloading a scene

Hi! My name is Ignacio and I'm new to the forums and to jME in general  :slight_smile:



I'm doing a bowling game for a Uni assignment using jME and jME Physics. Right now I've got a scene stored in an x3d file (that's one of the assignment requirements) and I'm experiencing a very weird situation so, after struggling with it for a couple of days, I decided it was time to ask for help. The scene is composed by a floor, a ball and 10 pins in an upright position.



OK, so here's the situation: during the game's startup process I load the scene using an instance of the X3dToJme class. Up to this point everything goes smooth, but when I need to reload the scene (eg. once the game is over) the first thing I do is detach every node in the scenegraph by using the detachChildNamed method from rootNode and then reload it again using the X3dToJme class instance. After reloading the scene all the pins, which should be upright, automatically fall apart, as if something in the physics system hadn't been properly cleared.



Do you have any suggestions on how to fix this? I can post code if you want to.



Thanks in advance for your help,



–Nacho

Are you also removing the objects physics representation from the physics space when you clear your scene? You will need to use the PhysicsNode.setActive(false) method and if you are using joints, joint.setActive(false). Have a look at the PhysicsSpace class, I believe there may also be some convenience method there which may help you.

Hy nymon, thanks for your answer. That made the trick!  :slight_smile:



–Nacho