HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

xecollider with parabola

02-20-2010, 03:24 PM#1
Majin
I'm trying to make a spell that completely emulates the attack of a ranged unit (Sylvanas) by using xecollider and the parabolic movement method from moyack

Collapse JASS:

private method parabolicMovement takes real h, real d, real x returns real
      return ((4 * h / d) * (d - x) * (x / d))
endmethod

method loopControl takes nothing returns nothing
      local real dist = SquareRoot((GetUnitX(targetUnit)-casterX)*(GetUnitX(targetUnit)-casterX)+(GetUnitY(targetUnit)-casterY)*(GetUnitY(targetUnit)-casterY))
      local real parX = dist-SquareRoot(((GetUnitX(targetUnit)-x)*(GetUnitX(targetUnit)-x))+((GetUnitY(targetUnit)-y)*(GetUnitY(targetUnit)-y)))
      set z = parabolicMovement(dist*0.15, dist, parX)
endmethod

and it works fine (the spell follows the same parabola of the unit's attacks), i just don't know how to correctly set the zangle of the unit

EDIT: for some reason i thought h and d in the parabolic function were variables and not constants, so i screwed up with the derivative (yeah i was trying to do a partial derivative...) ...now i got it corrected and it works

Collapse JASS:
            set zangle=((4*h)/d)-((8*h*x)/(d*d))

if anyone's interested this is the solution.