irr::core::matrix4 m;
m.setRotationDegrees(node->getRotation());
irr::core::matrix4 n;
n.setRotationDegrees(rotation);
m *= n;
node->setRotation( m.getRotationDegrees() );
But, how I can set a nodes rotation to a specific angle. For example i want the scene node rotate to this values: vector3df(15,30,0)
I can just use node->setRotation() method, but i think, it doesn't work as it is supposed to do. Because, the local and world space get mixed after a few rotation call. So node rotates to another angle than i want.
I have found that, i needed to use quaternions. I can now rotate one axis like i wanted but i can not keep the current rotation. I read that i need to create a quaternion with current rotations, and multiply with the newly created rotation quaternion, but that doesn't work.
Maybe your understanding of the angles is wrong, you should note that Irrlicht uses Euler angles, applied in order z,y,x. Multiplication of quaternions should also work, but only if you have to correct quaternions. Also make sure that you understand the application of the rotation vector. It's called relative rotation, but it's not relative with respect to the previous rotation, but ot the parent's rotation.
I've managed to make multiplying work. Now, i am trying to rotating the axis vectors, which i use for method fromAngleAxis(), to make the node rotate in its local space. I will paste the code here when finished.
i rotate the node around Y-AXIS 45 degrees. Everything is ok. And then i want to rotate the node around Z-AXIS 45 degrees. Now when i calculate the z unit vector; i get (1,0,1). (I don't use (0,0,1) vector because i want to rotate the node in its local space)
Then when i want to locally rotate the node around z-axis again, i calculate my z-unit vector and it is not (1,0,1) this time. Because the Y rotation (node->getRotation().Y) is not 45 any more.
Does the iscenenode holds these variables or is there any other method to correctly calculate the local z-unit vector?
i rotate the node around Y-AXIS 45 degrees. Everything is ok. And then i want to rotate the node around Z-AXIS 45 degrees. Now when i calculate the z unit vector; i get (1,0,1). (I don't use (0,0,1) vector because i want to rotate the node in its local space)
Then when i want to locally rotate the node around z-axis again, i calculate my z-unit vector and it is not (1,0,1) this time. Because the Y rotation (node->getRotation().Y) is not 45 any more.
Does the iscenenode holds these variables or is there any other method to correctly calculate the local z-unit vector?
can you show executable application?
are you use keys?
try to use
core::vector3df Rotation = obj->getRotation();
Rotation.Y += 45;
Rotation.Z +=45;
obj->setRotation(Rotation);