Hello World / plɹoM ollǝH

Programmers Live in Vain

Unityの回転値を右手座標系に変換

まず平行移動のX方向が逆なのでxに-1を掛けます

trans.x *= -1.0f;
return glm::translate(glm::mat4(), trans);

回転値はZXYオーダーで、ZとY回転に-1を掛けます

glm::mat4 m;
m = glm::rotate(glm::mat4(), -rotate.z, glm::vec3(0.f,0.f,1.f)) * m;
m = glm::rotate(glm::mat4(), +rotate.x, glm::vec3(1.f,0.f,0.f)) * m;
m = glm::rotate(glm::mat4(), -rotate.y, glm::vec3(0.f,1.f,0.f)) * m;
return m;

あとはお好きにどうぞ