Search the Community
Showing results for tags 'run-time node'.
-
Hello, I need to create a node (i.e. ObjectMeshStatic) at run-time and want to add it to list of nodes of already loaded world. So far, I've succeeded in creating the ObjectMeshStatic node. But when adding to nodes' list through Unigine::Editor::addNode method, node is not visible (not rendering). Also, I'm able to get the list of nodes in the current world with the newly created node's entry in the list. Here's the code for adding node dynamically (C++): bool createNodeRunTime() { Unigine::ObjectMeshStaticPtr pOMS = Unigine::ObjectMeshStatic::create("core/meshes/material_ball.mesh", 1 /*unique=1*/); if (!pOMS) return false; pOMS->setMeshName("core/meshes/material_ball.mesh"); //relative path to data dir. pOMS->setMaterial("material_ball", 0); pOMS->release(); Unigine::NodePtr newNode = pOMS->getNode(); if (!newNode) return false; Unigine::Editor::get()->addNode(newNode); m_vecNodes.append(newNode); // Unigine::Vector<Unigine::NodePtr> m_vecNodes; Unigine::Console::get()->run("world_save"); return true; } after executing world_save command, there's entry in world file as follows: <node type="ObjectMeshStatic" id="19595027" prefab_id="190089851" name="new_node"> <mesh_name>core/meshes/material_ball.mesh</mesh_name> <surface name="material_ball_mat" material="material_ball"/> <transform>1 0 0 0.0 0 1 0 0.0 0 0 1 0.0 1 1 1 1.0</transform> </node> When I'm starting the application and loading the same world file through config file, I'm able to see the node (i.e. ObjectMeshStatic) which was added earlier. I want to see the added node immediately in the rendering view. I don't know what and where I'm missing something... Any help greatly appreciated.
- 5 replies
-
- unigine2
- run-time node
-
(and 1 more)
Tagged with: