i need help with this one. p_movement is the vector of the relative movement of an actor (10,0,-5). y is always 0 because i have only walking actors. works fine for the ai.
in case of a human, the worldrotation depends on where the player is looking at, resulting in slower movements when he is looking into the sky or at his invisible feet. i want to eliminate the y-component of the worldrotations, but to be honest, i have no idea how quaternions work. i just used the methods that they offer and so far, any problem could be solved with them.
public void moveRelativeBy(final Vector3f p_movement, final boolean p_flattenMovement) {
getWorldRotation().multLocal(p_movement);
getLocalTranslation().addLocal(p_movement);
afterMove();
}
every idea i had so far (rotate 0,0,1 (forward) by worldrotation, set y to 0, get angle between z-axis and the new vector, rotate p_movement around it instead of worldrotation) involves lots of complex calculations and breaks the "every problem can be solved in 5 lines"-rule. can it be solved simpler?