diff --git a/include/zeus/CTransform.hpp b/include/zeus/CTransform.hpp index 3edcecf..3bf23bd 100644 --- a/include/zeus/CTransform.hpp +++ b/include/zeus/CTransform.hpp @@ -5,6 +5,7 @@ #include "zeus/CMatrix3f.hpp" #include "zeus/CMatrix4f.hpp" #include "zeus/CVector3f.hpp" +#include "zeus/CUnitVector.hpp" #include #include @@ -246,6 +247,20 @@ public: 0.f, 0.f, 0.f, 1.f); } + static zeus::CTransform MakeRotationsBasedOnY(const CUnitVector3f& uVec) + { + uint32_t i; + if (uVec.y < uVec.x || uVec.z < uVec.y || uVec.z < uVec.x) + i = 2; + else + i = 1; + + CVector3f v = CVector3f::skZero; + v[i] = 1.f; + CUnitVector3f newUVec(uVec.cross(v)); + return {newUVec, uVec, uVec.cross(newUVec), CVector3f::skZero}; + } + CMatrix3f basis; CVector3f origin; };