Trying to move a rotated scene node along its orientation I somehow need to "parent" the speed vector to the node, which is of course noth possible that way.
So I somehow have to rotate the speed vector (0,0,speed) by the scene node's Euler rotation.
Is there a way to do this, maybe with some kind of rotation matrix?
Or how does an according formula look?
rotating a vector
-
- Competition winner
- Posts: 688
- Joined: Mon Sep 10, 2012 8:51 am
Re: rotating a vector
The matrix class (in matrix4.h) allows you to rotate vectors.
CMatrix<T>::rotatedVect(vector3d<T>& vectorToBeRotated)
You have to create the matrix first, of course. Set its rotation axis (setRotationAxisRadians(angle, axisVector)) to <0,1,0> and then perform your rotation on the vector.
CMatrix<T>::rotatedVect(vector3d<T>& vectorToBeRotated)
You have to create the matrix first, of course. Set its rotation axis (setRotationAxisRadians(angle, axisVector)) to <0,1,0> and then perform your rotation on the vector.