hi, i have a problem in rotating a node(an arrow whose center is in the middle of the arrow) so i have calculated where i want the arrow to point in a unit vector like (0.5,0.5,0) which i mean i want to rotate the node 90 degree in x and y axis(even if it doesn't mean that it doesn't matter)
as my problem is that when in irrlicht and i give the node to rotate 45* in x and y axis
first it rotates it 45* in x-axis..then it rotates the x,y,z axis of the object with it..and then rotates it 45* in y axis...so in it points in a very different direction..... so my question in a clear form is:
how to make a mesh(arrow) point to another position in your 3d space!?
unit vector
-
- Posts: 616
- Joined: Wed Nov 01, 2006 6:26 pm
- Location: Cairo,Egypt
- Contact:
-
- Posts: 1215
- Joined: Tue Jan 09, 2007 7:03 pm
- Location: Leuven, Belgium
-
- Posts: 616
- Joined: Wed Nov 01, 2006 6:26 pm
- Location: Cairo,Egypt
- Contact:
i used the following to achieve this, I'm sure someone will come along with a better solution.
p.s. there a rh version for buildCameraLookAtMatrixLH by the way
it's a bit like going back to the early 1990's ![Wink ;)](./images/smilies/icon_wink.gif)
Code: Select all
matrix4 mat;
mat.buildCameraLookAtMatrixLH(vector3df(10.0,10.0,10.0),vector3df(20.0,-10.0,20.0),vector3df(0.0,1.0,0.0));
quaternion quat(mat);
vector3df euler;
quat.toEuler(euler);
node->setRotation(euler);
I couldn't agree moreI think irrlicht needs to support quaternion and matrix rotations besides euler angles, the needed implementations are all sitting there in the source code
![Smile :)](./images/smilies/icon_smile.gif)
![Wink ;)](./images/smilies/icon_wink.gif)