I was in charge of creating a jumping system, so I'm going to explain it here.
When the character jumps, we use an initial velocity. This velocity is then "divided" into horizontal velocity (Vh) and vertical velocity (Vv).
Here's a little image that shows how to do that:
So, if you know about sines and cosines, you know that they have the same value at 45 degrees, so if you wanted your vertical and horizontal velocities to be equal, the angle would have to be 45 degrees. Anyway, back to the game...
If this were a 2D game, we would be done there, however, this is a 3D game! Which means, we not only move in the X and Y axes (yes, that's the plural of "axis"). We use the Z axis as well.
So, we need to find out how much to move in the Z and in the X depending on the horizontal velocity and the orientation of the player.
The player has its own matrix. Matrices store rotation, translation and scale of an object.
In this case, we're interested in the player's rotation.
To explain it simply, a player will have its own X, Y and Z axes. So, when he rotates around one axis, the direction of the other two is altered.
So, we only need to get the angle in which every axis of the player's matrix!
However, since we won't only be moving on a plain, it means we will also be standing at angles, which means we have another issue which affects the movement in all three axes (instead of just the Y axis)... This is called "gravity".
And I will talk about this in the next post. Stay tuned!