# JumpPads on fixed spot [closed]

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;

-

## closed as off topic by Ross Millikan, M Turgeon, William, Thomas, Ｊ. Ｍ.Sep 29 '12 at 10:42

Questions on Mathematics Stack Exchange are expected to relate to math within the scope defined by the community. Consider editing the question or leaving comments for improvement if you believe the question can be reworded to fit within the scope. Read more about reopening questions here.If this question can be reworded to fit the rules in the help center, please edit the question.

I think this question would be better suited for physics.stackexchange –  M Turgeon Sep 24 '12 at 14:31

In response to the new question, where the arrival location is not at the same altitude as the departure location, let $v_y$ be the initial vertical velocity and $v_x$ the initial horizontal velocity. The path is then $(v_xt,v_yt-\frac 12 gt^2)$ Since you say $v_y$ is fixed, you can solve the quadratic to find the arrival time. You want the greater of the two values so you arrive on the downward trajectory. Given the time, you can calculate the $v_x$ you want.
Instead of force, think of initial velocity. Let $v_x$ be horizontal and $v_y$ be vertical. Your limit is then $v_{max} \ge \sqrt{v_x^2+v_y^2}$. The altitude at a given time will be $y=v_yt-\frac 12 gt^2$, so the time of flight is $t_f=\frac {2v_y}g$ and the distance tavelled in $x$ is $\frac {2v_xv_y}g$ You can rotate to get the jump along the right direction in the $xz$ plane. Is this in the direction you were looking for?
@PasqualeSada: In real physics, force divided by mass gives acceleration. The change in velocity is acceleration times time. So if the time is short, you can just work with change in velocity. For separating $x$ and $z$, you can regard the $v_x$ above as $v_r$, the radial velocity change. Then $v_x=v_r \cos \theta, v_z=v_r \sin \theta$ –  Ross Millikan Sep 24 '12 at 19:11