Simple trajectory - constant speed

:eyes: I’ve been looking at trajectory c# examples, tutorials and forum threads, this seems a bit complex. I am trying to find something that can help with calculations. I’m not that good at mathematics.

I have a start point (the player) and an end point (the destination) and I would like to send the player in a constant speed in a 3d arc that is calculated between the two points. (As if the player is jumping in an arc). Thanks for any help!

The problem with this is there are a infinite number of parabolas that can do this. We need a little more information first.

Do characters act like a real world jumper?
That is … I have a certain speed character is running to the right. When i press jump I push up with certain force and I’ll land whererver I should according to physics? This implies he could “miss” and bounce off the edge of the wall in front of him.

Do you have some kind of spot on the ground that launches the character up, and he appears at a designated spot on the next platform?
So you just want to move the character from Pos A, to Pos B… and instead of a teleport action you want it to be a smooth arc?

Do you need a mixture of the two. You want to jump like a real world jumper, but you want to guarantee he always makes it to a designated spot on the next platform. That is we will adjust his jumping force so he always lands on the next platform and always at the exact some spot (this one is the most complicated)

hi takatok, yes the start spot and the end spot are pre-determined.

Kind of need to lock the player to a curve and move them manually, so there is consistant speed.

I am looking into how to create bezier curve from 3 points. :slight_smile: not sure if I can send the player along the curve or not.

Following a trajectory at constant speed is not very natural. Are you sure you want this? However the ground speed of a projectile is constant (physical fact), maybe that’s what you want.

Your problem is not an easy one, you would need to do quiet a lot of math to obtain what you want. This Wikipedia page can be a starting point. It already contains an equation to find out what angle you would need to shoot to reach a given position at a given initial speed.

If you still want to follow the trajectory at a constant speed, here is a approach (which involves plenty of equation solving that I don’t feel like doing =) and don’t even know if it has a solution):

  1. Let’s say you have the equation of the trajectory, that is the position P function of time: P(t).
  2. Then you would need to figure out the travelled distance function of time: d(t).
  3. Solve d(t) for t so that you express the time t function of distance d: t(d).
  4. Substitute t in the trajectory equation, so that you have the position function of the traveled distance P(d).

Once you have P(d), you just need to change d linearly (for instance by doing a lerp over time) to obtain a constant travel speed.

yes constant speed is the way to go for this.

thanks for the thoughts, i’m still thinking, still researching. :sweat_smile:

it’s looking good so far! hurray.

Edit: lerping between units solved this.