rotating a vector

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
Vel0city
Posts: 4
Joined: Sun Sep 25, 2016 2:22 pm

rotating a vector

Post by Vel0city »

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?
chronologicaldot
Competition winner
Posts: 688
Joined: Mon Sep 10, 2012 8:51 am

Re: rotating a vector

Post by chronologicaldot »

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.
Post Reply