Height Distance and Stuff

BlackRose

Forum User
Reaction score
239
Herro.

Say I got a spell that shoots a fire ball onto the target location.

And my flying height is 700.
The target ground's height is 0.
And the distance I target is only 150 range away.

And the speed of the fireball is 900.

I'm absolelutely terrible and clueless at maths.... dunno how to phrase the question:confused:

JASS:
function GetLinearHeightByDistance takes real distance, real currDis, real startHeight, real endHeight returns real
    return (((distance-currDis) / distance) * startHeight) + endHeight
endfunction


Using something like this... but since it's dependent on distance, it will be messed up on very short total distances. I want to calculate both ground distance and height distance.

So my fireball which starts from 700 height will go down to 0 height smoothly :)

Help please in the most Simple English way possible <3
 

Skippy

Active Member
Reaction score
39
currDis/distance - number from 0 to 1; 0 means start, 1 means end.

So current height can be obtained this way:
JASS:
startHeight + currDis/distance * (endHeight - startHeight)

Example: distance = 150, startheight = 700, endheight = 0, currdis = 75
700 + 75 / 150 * (0 - 700) = 700 + 0.5 * (-700) = 350

It should work :)
 

Chaos_Knight

New Member
Reaction score
39
currDis/distance - number from 0 to 1; 0 means start, 1 means end.

So current height can be obtained this way:
JASS:
startHeight + currDis/distance * (endHeight - startHeight)

Example: distance = 150, startheight = 700, endheight = 0, currdis = 75
700 + 75 / 150 * (0 - 700) = 700 + 0.5 * (-700) = 350

It should work :)
Do you like maths?
 
General chit-chat
Help Users
  • No one is chatting at the moment.

      The Helper Discord

      Members online

      No members online now.

      Affiliates

      Hive Workshop NUON Dome World Editor Tutorials

      Network Sponsors

      Apex Steel Pipe - Buys and sells Steel Pipe.
      Top