HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Parabola problem

11-25-2007, 03:32 AM#1
Malf
I can't brain.

I need help with my maths, I need to know what should x be. h is the max height and d is the distance.

Collapse JASS:
function ParabolicMovement takes real h, real d, real x returns real
    // thanks to moyack for this func!
    local real a = -4*h/(3*d*d)
    local real b = 4*h/(3*d)
    return a*x*x + b*x
endfunction
11-25-2007, 01:41 PM#2
Iron_Doors
If I understand correctly x should be the current timestep or whatever and it should range from 0 to 1.
11-25-2007, 02:27 PM#3
moyack
no, x is a distance, in WC3meters :P

This function takes as a parameters the the distance that the parabolic movement should move (d) and the maximum height the projectile will flight (h).

So x is a value between 0 and d, and the function will return the height for that value.

As a side note, if x < 0 or x > d then this function will return negative values.

EDIT: Here's a picture:

Zoom (requires log in)
11-27-2007, 08:28 AM#4
Malf
Ahh, I get it, thanks moyack. Rep'd because I was currently trying to figure out how to solve the problem by swapping the arguments -.-