Jump to content
  • Advertisement
Sign in to follow this  

Smooth jumping arc

This topic is 2539 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

I have this plat former boss and one of his AI patterns involve him jumping from one spot to another (I give it coordinates to the next destination).

Originally, the boss would just navigate his way to the point. I decided I wanted the boss to make a jumping arc over everything (i.e. jumping really high up) to land precisely at the next point.

My problem is that the x-speed is constant, so if it is a large distance, the boss would need to jump really high to make it. I can't seem to come up with the right design.

Originally, I was going to show you my original calculations but.... they're embarrassingly bad. I feel like some simple geometry or basic calculus concept will come into play here.


Share this post

Link to post
Share on other sites
You could just clamp the height of the boss jumps, and the height at which it clamps at could be dependent on the distance of the jump. Not the best answer I know, but it would work.

Share this post

Link to post
Share on other sites
You could have it follow a parabola.

Y = Y[sub]0[/sub] + V[sub]y[/sub] * t + 1/2 * g * t ^2
X = X[sub]0[/sub] + V[sub]x[/sub] * t

Those two equations define the parabola

Y[sub]0[/sub] is the starting y position
X[sub]0 [/sub]is the starting x position

g is the amount of gravity you want to apply to your system, you can adjust this until it looks right
t is time in seconds
V[sub]y[/sub] is the staring Y speed
V[sub]x[/sub] is the string x speed

From this you could create a nice curve.

You can either define how much time you want the object to travel or the initial x speed, either one will be enought to define the curve.

Hopefully this is enough information to get you started. Google around and you can find more info, or if you need further clarification I can explain a bit more.

Share this post

Link to post
Share on other sites
Sign in to follow this  

  • Advertisement

Important Information

By using GameDev.net, you agree to our community Guidelines, Terms of Use, and Privacy Policy.

Participate in the game development conversation and more when you create an account on GameDev.net!

Sign me up!