Vector3 and Point3 in native extension

In a native extension function I have a vector3 (pulled from lua) and I want to use it to set the position of a gameobject. Is the following the right way to convert the Vector3 to a Point3 and use it in SetPosition?

// convert vector3 to point3
dmVMath::Point3 p3 = dmVMath::Point3( p->getX(), p->getY(), p->getZ()) ;
// set the position of the gameobject
SetPosition(g ameobjectInstance, p3 );

Or is there a conversion method already implemented in the engine? or a version of SetPosition using a Point3? I tried to look at the source code but I was not able to find anything.

Thank you so much!

You can cast vector3 to point3: dmVMath::Point3 p3 = (dmVMath::Point3)p;

1 Like

Thanks @selimanac ! Yeah! I knew there was a simpler way! Sorry for the silly question…

1 Like