三维中旋转矩阵可以用mat3或quat表示。两者可以转换。
quat q = m_node->getWorldRotation();
mat3 m3 = q.getMat3();
mat3 m3 = q.getMat3();
单位旋转矩阵刚好是单位的-forward up -right 的组合。
Log::message("%s\n",Engine::get()->runWorldFunction(Variable("typeinfo"), Variable(m3.getColumn(0))).getString());
Log::message("%s\n", Engine::get()->runWorldFunction(Variable("typeinfo"), Variable(m3.getColumn(1))).getString());
Log::message("%s\n", Engine::get()->runWorldFunction(Variable("typeinfo"), Variable(m3.getColumn(2))).getString());
Log::message("%s\n", Engine::get()->runWorldFunction(Variable("typeinfo"), Variable(m_node->getWorldTransform())).getString());
Log::message("%s\n", Engine::get()->runWorldFunction(Variable("typeinfo"), Variable(m_node->getWorldForward())).getString());
Log::message("%s\n", Engine::get()->runWorldFunction(Variable("typeinfo"), Variable(m_node->getWorldRight())).getString());
Log::message("%s\n", Engine::get()->runWorldFunction(Variable("typeinfo"), Variable(m_node->getWorldUp())).getString());
Log::message("%s\n", Engine::get()->runWorldFunction(Variable("typeinfo"), Variable(m3.getColumn(1))).getString());
Log::message("%s\n", Engine::get()->runWorldFunction(Variable("typeinfo"), Variable(m3.getColumn(2))).getString());
Log::message("%s\n", Engine::get()->runWorldFunction(Variable("typeinfo"), Variable(m_node->getWorldTransform())).getString());
Log::message("%s\n", Engine::get()->runWorldFunction(Variable("typeinfo"), Variable(m_node->getWorldForward())).getString());
Log::message("%s\n", Engine::get()->runWorldFunction(Variable("typeinfo"), Variable(m_node->getWorldRight())).getString());
Log::message("%s\n", Engine::get()->runWorldFunction(Variable("typeinfo"), Variable(m_node->getWorldUp())).getString());
结果: