I ask because so much of the API seems to be missing. I’ve found work arounds for what I’ve needed so far, but I’m starting to worry that I could put a lot of work into this only to hit a brick wall down the line.
Latest problem was wishing to find the 3D position of a node in world space. Node has convertToWorldSpace, but that’s for 2D not 3D and there is no equivalent for 3D.
Okay, that shouldn’t be a problem because Node does have getNodeToWorldTransform, so all I need to do is get that transform and use it to map the point (0,0,0). Mat4 does have a transformPoint method.
Ah, but transformPoint isn’t exported to lua. transformVector is there but that in its three argument form ignores the translation part of the transform.
Oh hang on, there is another six argument form that takes the four separate components of the input vector. That would work if I give 1.0 for the w value. What’s more, if I look in lua_cocos2dx_manual.cpp at tolua_cocos2d_Mat4_transformVector it actually tests for either 3 or 6 arguments.
Seemed hopeful, but no: looking in Cocos2d.lua, there is only this
function cc.mat4.transformVector(self, vector, dst)
return mat4_transformVector(self, vector, dst)
end
so only the 3 argument version can be used from lua
In this particular case, seeing as I am tranforming the point (0,0,0) I can just pick out four of the indexes from the transform, but it’s just luck that I have that work around.
Hence, my question…