Code: Select all
core::vector3df vecCentral;
core::vector3df vecOrbital;
Code: Select all
core::matrix4 matix;
Code: Select all
core::vector3df vecCentral;
core::vector3df vecOrbital;
Code: Select all
core::matrix4 matix;
So rotation matrix can only rotate points around origin of the coordinate system? Then I will have to do rotation myself.... WTF irrlicht?mongoose7 wrote:You can't do it with a rotation matrix. You need a translation matrix to move vecCentral to the origin, then a rotation matrix to rotate the world, then the inverse of the translation matrix to move the origin to vecCentral. I'd be trying to find m.translate() and m.rotate() in the matrix class. Perhaps look in matrix4.h or check the documentation.
It's not Irrlicht's fault, blame mathematicians from 160+ years ago. That's just how it works. A rotation matrix rotates around the origin, a scale matrix scales around the origin. But a translation matrix effectively moves the origin, and all of these can be combined together in a single matrix4.AlexAzazel wrote:So rotation matrix can only rotate points around origin of the coordinate system? Then I will have to do rotation myself.... WTF irrlicht?mongoose7 wrote:You can't do it with a rotation matrix. You need a translation matrix to move vecCentral to the origin, then a rotation matrix to rotate the world, then the inverse of the translation matrix to move the origin to vecCentral. I'd be trying to find m.translate() and m.rotate() in the matrix class. Perhaps look in matrix4.h or check the documentation.
Code: Select all
irr::core::quaternion q;
q.fromAngleAxis(rotationSpeed * frameDeltaTime, rotationAxis);
vecOrbital = vecCentral + q * (vecOrbital - vecCentral);
Kojack wrote: I'd probably do it using quaternions instead. For example (if vecOrbital is a world position):Code: Select all
irr::core::quaternion q; q.fromAngleAxis(rotationSpeed * frameDeltaTime, rotationAxis); vecOrbital = vecCentral + q * (vecOrbital - vecCentral);