Jump to content

[SOLVED] How to call a function and get value from a script in c++


photo

Recommended Posts

I'm getting a compile error with this ... what is the correct syntax for getting values returned from a script to c++?

 

Mat4 matrix;
matrix.setIdentity();
const Variable var = (*theEngine)->runWorldFunction((Variable)"getViveCameraPosition", (Variable)(matrix));
matrix = VariableToType<Mat4>(Interpreter::get(), var); // compile error

The compile error:

error C2679: binary '=' : no operator found which takes a right-hand operand of type 'Unigine::VariableToType<Unigine::Math::dmat4>' (or there is no acceptable conversion)

 

This script function:

Mat4 getViveCameraPosition(Mat4 matrix)
{ ...

 

Link to comment

Ok, I got it to work:

Mat4 matrix;
matrix.setIdentity();
const Variable var = (*theEngine)->runWorldFunction((Variable)"getViveCameraPosition", (Variable)(matrix));
matrix = VariableToType<Mat4>(Interpreter::get(), var).value;
Link to comment
×
×
  • Create New...