HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Parabolic Jump w/ Uneven Beginning and End Z's

01-02-2009, 07:00 AM#1
Here-b-Trollz
I'm trying to put together a parabolic jump that does exactly what I want it to do. Unfortunately, I don't think I payed enough attention in math. Here's what the jump needs to do:
  • Land at exactly the target point
  • Factor in terrain height
  • Achieve a minimum height from both the start and end Z's

So, basically I need to calculate a, b and c in y=ax^2+bx+c, and then throw in x (distance) to get y (height) at every time step. y would be in absolute height, and I'd subtract out the Z of whatever the current location is, and set my unit's fly height to that.
I suppose the equation could be in other forms too, like y=a(x-h)^2+k
Expand Example:

So how do I calculate a, b and c when the spell is cast? Or, do you have another way to do what I'm proposing?


Random Thought:
I seem to remember something where a=gravity, b=initial speed and c=initial height, so would that imply that a is a constant, c is self explanatory, and I just need to solve for b? How would I do that?
01-02-2009, 07:11 AM#2
Pyrogasm
This might help: http://wc3campaigns.net/showthread.php?t=102077
01-02-2009, 07:17 AM#3
Rising_Dusk
This does exactly what you want.
01-02-2009, 07:23 AM#4
Here-b-Trollz
The parabola function is not helpful, nope.

Alright, I'll take a look at that system. Was bugging a little when I tested it, so I'll just rip the code out and vJass it...
01-02-2009, 08:19 AM#5
Jazradel
I have a system as well. It's fairly old, but the math itself is simple.
01-02-2009, 12:47 PM#6
Zerzax
I think projectile motion can use the equation 9.8x^2 + bx + c (only remembered a) can be used for "rocket" problems in math and such. Anyway, I would try doing this: Take the difference in Z heights of the target and start locations and "factor it in" somehow, like addition to the total Z-offset of the parabola. That way, if you are going uphill you will increase the Z-offset of your arc, and if you are going downhill the negative height will compensate. I'm no math expert, just an idea. My guess is Dusk's system is the right choice, though I haven't looked at it.
01-02-2009, 01:29 PM#7
Anitarf
a is equal to gravitational acceleration, something like -1000
b is the starting velocity, this is the value you need to calculate
c is the starting z offset.

With a constant horizontal velocity v, the horizontal distance between the caster and the target d and the vertical distance z, b is calculated as

b= -a*(d/v)/2 + z/(d/v)