I've been working on physical jumping in a 3D environment, I've got it working with a static force. The problem with this is that the force on each axis should be different due to the rotation from the player.
A few things to keep in mind:
- A total rotation of 360 degrees can be made;
- Forces should never be greater than 0.2 or lower than -0.2;
- There is no framework/engine behind the game, it's all hardcore codings.
I've been trying something like;
velocity.x = x - ( x + ( 10 * math.cos ( ( rz + 90 ) * math.pi / 180 ) ) ); velocity.y = y - ( y + ( 20 * math.cos ( ( rz + 90 ) * math.pi / 180 ) ) );
where x,y is the spawned location and rz is the rotation from the player. This way, I'll get the location from the player 20 units in front of him. By subtracting the actual starting position from it, I should've gotten a velocity. However, this turned out to be wrong. It's not going towards the direction the user is facing, it's just doing it's own simple thing.
The jumping/throwing into 1 direction is working perfectly fine. The calculations I made so far are totally messed up and not working as expected.
The results which I am expecting to get is something like;
force.x = 0.1; force.y = 0.2;
this can be negative or positive, this should be dynamic though.