Jump to content

How to create a object without using unigine script?


photo

Recommended Posts

How to create a object and set the position without using unigine script?

I have read some exampls all of which need unigine script.

 

Could anyone give an example ?

thanks very much.

Link to comment
  • 2 months later...

BUMP :rolleyes:

 

The fact that we don't seem to be able to create nodes from C++ is a real issue for us. To help the original post, we can quite successfully move existing objects with ...

Unigine::Node::setWorldTransform(const Unigine::mat4 &transform)

... although you need to be careful how you create the world transform matrix.

 

However, we are still unsure how to create an object from C++. Sure, there is ...

Unigine::ObjectMeshDynamic::create(Unigine::NodePtr node)

... but you still need to have a node already created to use this.

 

This leaves us having to write a wrapper function in script just so that we can call it from C++ ...

Node LoadNode(string node_name)
{
   return engine.world.loadNode(node_name);
}

... and it is disappointing, but seemingly necessary, to have to do something like this ...

Unigine::Variable new_node = engine->runWorld("LoadNode", node_name);
loaded_nodes.push_back(new_node.getNode());

Have we missed a way to do this solely from C++?

We need C++ control because the Unigine engine is being plugged into an existing GUI that builds content and thus we need to dynamically create, destroy and modify objects/nodes.

 

It appears that the C++ API is quite restricted compared to that for the UnigineScript. This results in us having to write the sort of code shown above for many of the missing functions, which is not only laborious but concerns us as being undesirably expensive at run-time.

 

Does anybody know if there is a reason why the C++ API needs to be so minimal? Is it possible to expand this API to provide all functionality that is available from within the script? This would be really appreciated.

Link to comment
×
×
  • Create New...