I have a problem that can't solve. I have my char standing in a fixed spot, a fixed jump force (hey the guy can jump very high but has his limits!) and a fixed landing spot(the one I want the char to land) but I must find if I'm in the right spot to jump(the jump is achievable, there are no obstable and my the char jump force can land in the right spot) then I must apply the right xforce and zforce (yforce is fixed remember? ) to steer the guy on the right spot. I've tried to implement the formula suggested but my character jumps away from the pad xD
deltaPosition = target - character_position;
sqrtTerm = Sqrt(2*-gravity.y * deltaPosition.y + MaxYVelocity* character_MaxForce);
time = (MaxYVelocity-sqrtTerm) /gravity.y;
speedSq = jumpVelocity.x* jumpVelocity.x + jumpVelocity.z *jumpVelocity.z;
if speedSq < (character_MaxForce * character_MaxForce) we have the right time so we can store the value
jumpVelocity.x = deltaPosition.x / time;
jumpVelocity.z = deltaPosition.z / time;
otherwise we try the other solution
time = (MaxYVelocity+sqrtTerm) /gravity.y;
and then store it
jumpVelocity.x = deltaPosition.x / time;
jumpVelocity.z = deltaPosition.z / time;
jumpVelocity.y = MaxYVelocity;
rigidbody_velocity = jumpVelocity;
