marina.kovalevskaya Posted August 22, 2014 Share Posted August 22, 2014 Good day! I need to generate a lot of identical objects automatically. I try to generate a single object on the object (such as .node) on the disk. It is generated but without reference to the source (code and picture) Code: int init() { Player player = new PlayerSpectator(); player.setDirection(Vec3(50,50,50)); player.setPosition(Vec3(0,0,0)); engine.game.setPlayer(player); Node node = new NodeReference("D:\Unigine\node\BottomDuplex1.node"); Node node1 = node.clone(); engine.editor.addNode(node1); return 1; } Tell me please how to clone an object? Link to comment
silent Posted August 22, 2014 Share Posted August 22, 2014 Do you have any errors in console? You should escape back slashes in your node path string to get correct result (or use forward slashes): "D:\\Unigine\\node\\BottomDuplex1.node" or D:/Unigine/node/BottonDuplex1.node. Also, if your nodes located inside data folder you can use relative path instead (for example, samples/objects/physics/meshes/cloth_01.node). Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
marina.kovalevskaya Posted August 22, 2014 Author Share Posted August 22, 2014 Thank you! But after second loading the my world, Unigine Engine falls. After first loading my world, in console such errors: Link to comment
silent Posted August 22, 2014 Share Posted August 22, 2014 We can't reproduce crash with this code. Check the engine log for errors, maybe there will be some errors or warning that can be useful. Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
marina.kovalevskaya Posted August 25, 2014 Author Share Posted August 25, 2014 Hello! 1. We added code in function Init(): Node node = new NodeReference("Lozhok/node/BottomDuplex1.node"); node.setName("Buttom"); engine.editor.addNode(node); 2. We loaded world for the first time - successfully. 3. We loaded world for the second time - Unigine Engine fell. What is wrong we have done? Thanks! We have attached engine log: my_project_log.htm Link to comment
silent Posted August 25, 2014 Share Posted August 25, 2014 Please, replace engine.editor.addNode(node) with following: engine.editor.addNode(class_remove(node)). Detailed explanation of class_remove() you can find in Memory Management article. Thanks! How to submit a good bug report --- FTP server for test scenes and user uploads: ftp://files.unigine.com user: upload password: 6xYkd6vLYWjpW6SN Link to comment
Recommended Posts