How to load saved physics?

I used the BinaryExporter to save a scene graph including regular Nodes and Physics nodes.

Trying to restore them with the BinaryImporter results in a:

Class com.jme.util.export.binary.BinaryClassLoader can not access a member of class com.jmex.physics.StaticPhysicsNode with modifiers "protected"

Did I miss something?

Sounds like a bug in StaticPhysicsNode, not your code.

I don't know. The constructors are protected for a reason.

The only public available constructor for StaticPhysicsNodeImpl takes the PhysicsSpace as a parameter.

The BinaryImporter doesn't have a chance to instanciate the physicsnode as it doesn't have an idea what PhysicsSpace to use.

So I think that saving and loading for PhysicsNodes just works differently and that there is some documentation missing.

pflanzenmoerder said:

So I think that saving and loading for PhysicsNodes just works differently

that's true

I'm not sure that StaticPhysicsNodes are working. I'll contact the guy who programmed the physics store/load, stay tuned.


I'll finish the stuff I am working on right now.

If help is needed or you can't reach him just tell me, then I will start diving into the sourcecode and try to fix it.

By default, the BinaryClassLoader does not know that the PhysicsNode classes can't be instantiated directly. You have to set it up with BinaryLoaderModules for the PhysicsSpace you are using. The following line does that:

physicsSpace.setupBinaryClassLoader( BinaryImporter.getInstance() );

There is a patch underway which translates the exception to a more comprehensible error message.



Doing Happy Dance

Thanks a lot!! :smiley:


(patch commited as well)