Vector calculation

I have a vector calculation question.

I having two vectors:

  • Ground Vector: The normal of the ground the player is currently on.
  • Movement Vector: The wanted movement for the player

I want to calculate the vector for how the player actual have to move.

Anyone that can help me?


You could do that like this:

 var actualMovementDirection = Quaternion.FromToRotation(Vector3.up, groundNormal) * movementDirection;

Work out the rotation of a vector from up to the actual ground normal and modify the movement direction by the same amount.