Jump to content

[SOLVED] Clone object from node on disk


photo

Recommended Posts

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?

post-1453-0-70152600-1408699849_thumb.png

post-1453-0-33823600-1408699850_thumb.png

Link to comment

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:

Link to comment

Thank you! But after second loading the my world, Unigine Engine falls.

 

After first loading my world, in console such errors:

 

 

post-1453-0-70399700-1408707043_thumb.png

Link to comment

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
×
×
  • Create New...