Jump to content

[SOLVED] How to load a node file twice and maintain separate meshes for each instance?


photo

Recommended Posts

I have a custom class which loads a .node and grabs an ObjectMeshStaticPtr using the following:

Unigine::NodePtr myNode = Unigine::World::get()->loadNode(nodePath, 0);
Unigine::Editor::get()->addNode(myNode);
ObjectMeshStaticPtr myMesh = Unigine::ObjectMeshStatic::create(myNode);

The node in 'nodePath' references a .mesh file on disk. The node is displayed in the world as expected, and the transforms of all myMesh's surfaces are altered every update() tick based on user input or from a data stream on disk. This all mostly works...

 

The issue arises when I try to instantiate multiple instances of my class that are loading the same node file on disk. When this happens, modifying the surface transforms of myMesh in any one class instance seems to also affect myMesh in all other instances of my class that loaded the same node file. If my class instances load different node files, there is no problem and the meshes can be updated independently. I need to be able to modify each mesh independently regardless of whether the .node or .mesh is shared. How can I achieve this?

Link to comment
×
×
  • Create New...