I have a problem with rotating my scene node correctly. The task is: I have a target, where the unit should go. So I set up the direction vector by substracting the position of the scene node from the target - nothing difficult until here.
But how can I get the rotation out of this vector? The native Direction is (1,0,0). There is the Rotation (0,0,0). But how can I get the rotation with a Direction like (20, 7.5, -9)?
SceneNode Rotation
You can use one of the matrix4::buildCameraLookAt functions to create a lookAt matrix and matrix4::getRotationDegrees() to get the rotation.
The default vector with rotation(0,0,0) is either (0,0,1) or (0,0,-1) (depends on the matrix function).
The buildLookAt function must have 3 different vectors, if at least two of them are equal it will fail.
The default vector with rotation(0,0,0) is either (0,0,1) or (0,0,-1) (depends on the matrix function).
The buildLookAt function must have 3 different vectors, if at least two of them are equal it will fail.