Need math help

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?

Ok, let's see if I understand your problem correctly. You want to get your speed vector to be always the same magnitude in the XZ plane regardless of the direction (up-down) your node is looking at?



If so, then just set the y-coordinate to 0, normalize your vector and rescale it to the appropriate size. This is as easy as it gets… If you meant something else, please specify.

yes, that indeed is a good, clean and simple solution. you were a good substitute for my own brain. thank you.