I have a player's figure which should shoot along its line of sight. It is a third person game, so I cannot take the line of sight of the camera for this task.
I thought about taking the local rotation of the figure and a vector representing the initial line of sight. Then, I want to rotate this vector with help of the rotation quaternion to get the current line of sight.
So I came that far:
Quaternion quat = vehicle.getLocalRotation();
Vector3f initDirection = new Vector3f(1,0,0);
Then I noticed, that Vector3f has no "setLocalRotation()" (or something else) :'(
I think I have to use values of Quaternion#toAngles() or similar to calculate the current line of sight. But I have no real idea how to do this properly. Can anyone help me?
To do what you are talking about with transforming a given Vector according to where your node is facing, you would use vehicle.localToWorld(initDirection, store).
Core-Dump's method of using getRotationColumn is easier though, if you just need one of the axes.
Just to clarify, what you need to do is multiply the world rotation quaternion and the initial vector. That operation provides a new vector which the vector you look for: