Skip to main content
added a warning
Source Link
  • here's a nice article about jump math: How to Calculate the Jump Height From Acceleration
  • time to reach top of our jump is: t = Vy/g (it's obvious, we need to lose our vertical speed completely)
  • height of our jump is: h = Vyt + (gt²)/2 WARNING: this formula assumes your "g" is a negative number. if not, change the formula to: h = Vyt - (gt²)/2
  • formula for time we will fall from there to the platform is: enter image description here where d is h - platform.height (taken from Wikipedia:Equations for a falling body)
  • sum both t, and we get a time of our jump.
var vertical_distance:Number = platform.height - ground.height;
var Vh:Number = Math.sqrt ( Vx*Vx + Vz*Vz );
var time_to_top:Number = Vy/gravity;GRAVITY;
var jump_height:Number = Vy*tVy*time_to_top +- g*t*tGRAVITY*time_to_top*time_to_top/2
if ( jump_height >= vertical_distance ) {
   var falling_distance:Number = jump_height - vertical_distance;
   var time_to_fall:Number = Math.sqrt ( 2 * falling_distance / gravityGRAVITY );
   var jump_time:Number = time_to_top + time_to_fall;
   var jump_length = Vh*tVh*jump_time + .5 * accelerationACCELERATION * tjump_time * t;jump_time;
   return jump_length;
} else throw error or something

Check out The Jumping Squareman minigame!

var vertical_distance:Number = platform.height - ground.height;
var Vh:Number = Math.sqrt ( Vx*Vx + Vz*Vz );
var time_to_top:Number = Vy/gravity;
var jump_height:Number = Vy*t + g*t*t/2
if ( jump_height >= vertical_distance ) {
   var falling_distance:Number = jump_height - vertical_distance;
   var time_to_fall:Number = Math.sqrt ( 2 * falling_distance / gravity );
   var jump_time:Number = time_to_top + time_to_fall;
   var jump_length = Vh*t + .5 * acceleration * t * t;
   return jump_length;
} else throw error or something
  • here's a nice article about jump math: How to Calculate the Jump Height From Acceleration
  • time to reach top of our jump is: t = Vy/g (it's obvious, we need to lose our vertical speed completely)
  • height of our jump is: h = Vyt + (gt²)/2 WARNING: this formula assumes your "g" is a negative number. if not, change the formula to: h = Vyt - (gt²)/2
  • formula for time we will fall from there to the platform is: enter image description here where d is h - platform.height (taken from Wikipedia:Equations for a falling body)
  • sum both t, and we get a time of our jump.
var vertical_distance:Number = platform.height - ground.height;
var Vh:Number = Math.sqrt ( Vx*Vx + Vz*Vz );
var time_to_top:Number = Vy/GRAVITY;
var jump_height:Number = Vy*time_to_top - GRAVITY*time_to_top*time_to_top/2
if ( jump_height >= vertical_distance ) {
   var falling_distance:Number = jump_height - vertical_distance;
   var time_to_fall:Number = Math.sqrt ( 2 * falling_distance / GRAVITY );
   var jump_time:Number = time_to_top + time_to_fall;
   var jump_length = Vh*jump_time + .5 * ACCELERATION * jump_time * jump_time;
   return jump_length;
} else throw error or something

Check out The Jumping Squareman minigame!

added code
Source Link
  • here's a nice article about jump math: [How to Calculate the Jump Height From AccelerationHow to Calculate the Jump Height From Acceleration
  • time to reach top of our jump is: t = Vy/g (it's obvious, we need to lose our vertical speed completely)
  • height of our jump is: h = Vyt + (gt²)/2
  • formula for time we will fall from there to the platform is: enter image description here where d is h - platform.height (taken from Wikipedia:Equations for a falling body)
  • sum both t, and we get a time of our jump.
  1. Now we need to know how far the player will move during the jump. If he doesn't accelerate, this will be distance = Vx*t, but he does. So there's formula for that too: d = Vt + (1/2)at²
  2. We found the max distance of the jump! All youYou need to do is make a circle with center in point you want to reach and radius of the distance calculated, and then find your way to the circle (if you're not inside it already).
  3. Obviously, wherever you are, if there are no obstacles, shortest wayget to the circle is a line between you and center of the circle, and you needplatform to travelthat distance-circle_radius or closer to reachbe able to jump onto it. - good luck!

Read moreAnd here's code: How to Calculate the Jump Height From Acceleration | eHow.com http://www.ehow.com/how_8771263_calculate-jump-height-acceleration.html#ixzz27zGYWnD6 ]3

var vertical_distance:Number = platform.height - ground.height;
var Vh:Number = Math.sqrt ( Vx*Vx + Vz*Vz );
var time_to_top:Number = Vy/gravity;
var jump_height:Number = Vy*t + g*t*t/2
if ( jump_height >= vertical_distance ) {
   var falling_distance:Number = jump_height - vertical_distance;
   var time_to_fall:Number = Math.sqrt ( 2 * falling_distance / gravity );
   var jump_time:Number = time_to_top + time_to_fall;
   var jump_length = Vh*t + .5 * acceleration * t * t;
   return jump_length;
} else throw error or something
  • here's a nice article about jump math: [How to Calculate the Jump Height From Acceleration
  • time to reach top of our jump is: t = Vy/g (it's obvious, we need to lose our vertical speed completely)
  • height of our jump is: h = Vyt + (gt²)/2
  • formula for time we will fall from there to the platform is: enter image description here where d is h - platform.height (taken from Wikipedia:Equations for a falling body)
  • sum both t, and we get a time of our jump.
  1. Now we need to know how far the player will move during the jump. If he doesn't accelerate, this will be distance = Vx*t, but he does. So there's formula for that too: d = Vt + (1/2)at²
  2. We found the max distance of the jump! All you need to do is make a circle with center in point you want to reach and radius of the distance calculated, and then find your way to the circle (if you're not inside it already).
  3. Obviously, wherever you are, if there are no obstacles, shortest way to the circle is a line between you and center of the circle, and you need to travel distance-circle_radius to reach it.

Read more: How to Calculate the Jump Height From Acceleration | eHow.com http://www.ehow.com/how_8771263_calculate-jump-height-acceleration.html#ixzz27zGYWnD6 ]3

  1. Now we need to know how far the player will move during the jump. If he doesn't accelerate, this will be distance = Vx*t, but he does. So there's formula for that too: d = Vt + (1/2)at²
  2. We found the max distance of the jump! You need to get to the platform to that distance or closer to be able to jump onto it - good luck!

And here's code:

var vertical_distance:Number = platform.height - ground.height;
var Vh:Number = Math.sqrt ( Vx*Vx + Vz*Vz );
var time_to_top:Number = Vy/gravity;
var jump_height:Number = Vy*t + g*t*t/2
if ( jump_height >= vertical_distance ) {
   var falling_distance:Number = jump_height - vertical_distance;
   var time_to_fall:Number = Math.sqrt ( 2 * falling_distance / gravity );
   var jump_time:Number = time_to_top + time_to_fall;
   var jump_length = Vh*t + .5 * acceleration * t * t;
   return jump_length;
} else throw error or something
Source Link

Your question is still missing the physics of your jumps. Does player's avatar accelerate when in air? Do jump physics simulate gravity well? That is the avatar's initial Vy is decelerated by 9.81 m/s every second? Still, I will present you a way how easily solve this mathematic problem.

  1. Let's start with representing our problem. In this case we can do this in 2D! jump on platform
  2. Now let's assume a few things:
  • we're using real physics (considering gravity, but not considering air friction etc.)
  • you can still steer while in air, and therefore, you can easily avoid such situation: enter image description here
  • this means we should only care about being near enough to be able to jump onto a platform; we want to find an outermost distance from our target, that we can jump through to it.
  1. Let's analyze what happens, when we jump:
  • we get initial speed Vy
  • gravity makes this speed decrease by g m/s every second
  • at some moment we reach the highest point and start to fall
  • speed increases by g m/s until we fall on something
  • all this time we're moving 'forward' by our initial velocity Vx
  • moreover, all this time we're accelerating (because if we want to reach the platform from the furthest place possible, we need to hold UP key), increasing our Vx
  • what we want to know is, how long have we been in air, and therefore, how much could we travel.
  1. Time of the jump
  • here's a nice article about jump math: [How to Calculate the Jump Height From Acceleration
  • time to reach top of our jump is: t = Vy/g (it's obvious, we need to lose our vertical speed completely)
  • height of our jump is: h = Vyt + (gt²)/2
  • formula for time we will fall from there to the platform is: enter image description here where d is h - platform.height (taken from Wikipedia:Equations for a falling body)
  • sum both t, and we get a time of our jump.
  1. Now we need to know how far the player will move during the jump. If he doesn't accelerate, this will be distance = Vx*t, but he does. So there's formula for that too: d = Vt + (1/2)at²
  2. We found the max distance of the jump! All you need to do is make a circle with center in point you want to reach and radius of the distance calculated, and then find your way to the circle (if you're not inside it already).
  3. Obviously, wherever you are, if there are no obstacles, shortest way to the circle is a line between you and center of the circle, and you need to travel distance-circle_radius to reach it.

Read more: How to Calculate the Jump Height From Acceleration | eHow.com http://www.ehow.com/how_8771263_calculate-jump-height-acceleration.html#ixzz27zGYWnD6 ]3