Saving Scenes (Nodes, Geometries and their physics)

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.