Saving Scenes (Nodes, Geometries and their physics)

Hello!



I want to safe my complete JME3 Scene , consisting of Nodes and Geometries which have a RigidBodyControl. I want to safe in the jme3-binary format. I just checked out this tutorial: https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:save_and_load?s[]=save&s[]=load



And I have some questions:


  • Do I really have to detatch all child-spatial from a Node when I want to safe? (This means that I have to save each spatial individually - is there a more comfortable build-in support?)


  • If I have to save each spatial individual: Can I save the RigitBodyControls of the Geometries, current forces, move speed, fall speed, ect. Any build-in support?





    Thanks!

The point is that you would save all models with it, if you want to do that you can keep them attached.

And what about the RigidBodyControls? If I save the rootNode… will the RigidBodyControls or VehicleControls of my Geometries also be saved?

I don’t know if you CAN save a RigidBodyControl, BUT you can save its information.

Put the RigidBodyControls in XML Code and load them after.

There are librarys that write your whole Object in XML and reconstruct it when you load the XML file (this is how I am going to try this :slight_smile: ).

Here you find such a library:

http://xstream.codehaus.org/

Looks interesting. I will test it. Thanks!

Guys, its all serialized with it, thats why you can add RigidBodyControls in the SceneComposer :roll:

Yes, I believe that the scenecomposer is a very useful tool. But I really need some scene-editing functionalities in my own application. Correct me If I am wrong, but I think that it isnt possible to save the RigidBodyControl if one saves a Geometry which is controlled by that rbc because it must be synchronized with the Physicspace. Furthermore (I hope I got that right) one is not allowed to add the control to the geometry before adding the geometry to the rootNode. I violate this convention when attaching a Geometry WITH RBC (loaded from a j3o) to the rootnode.



Why do I think so?



Lets see what I have to do when I want to load my save status again:

  • I think I have to attach every single Geometry to the rootNode
  • AND (and this is very pity) the RBC of the Geometry to the physicspace!



    When I load a j3o file (which has a Node with some Geometries as children saved) then I dont think that I can add the RBCs of the Geometries to the Physicspace.



    Follows that I have to do for saving:
  • save each Node and each Geometry in an individual j3o-file.
  • storing the tree information as XML (which node is parent of which geometry ect.)



    And for Loading
  • reading XML tree structure information
  • loading the scenegraph recursively
  • enabling the rbcs of the geometries
  • adding rbcs to the physicspace



    I have implemented like this now. Time-consuming… but it looks ok and it seems to work.

Hello? Somebody home? That is what j3o already does!! There is no need to do this.

2 Likes
Guys, its all serialized with it, thats why you can add RigidBodyControls in the SceneComposerA plugin in the jMonkeyEngine3 SDK, allows editing the content of j3o files which represent a complete scene or model.

Didn't know that :roll:
Sorry

Still going to use it for saving objects, rigidbodys, filters and stuff in one file.