unigine 三维旋转矩阵(mat3,quat) 变换矩阵(mat4) 和forward up right 关系

                        三维中旋转矩阵可以用mat3或quat表示。两者可以转换。
                        
                        quat q = m_node->getWorldRotation();
                        mat3 m3 = q.getMat3();

                        mat4 表示旋转和位移

                        
                        单位旋转矩阵刚好是单位的-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());
结果:

猜你喜欢

转载自blog.csdn.net/qiushangren/article/details/79481678
今日推荐