Math question

naughty

New Member
Reaction score
12
I have a spell that moves a unit from his position to another position. Its done by trigger. By that time the unit is paused and it plays an animation. If the range from those points is 800 the animation speed is 100% and it is perfect. Now i need somehow to make an "if" so that if the range is 400 than animation speed needs to be 200%, if the range is 200 animation speed is 300% etc.
For example:
range is 343.31
animation speed should be ???
 

SineCosine

I'm still looking for my Tangent
Reaction score
77
Use simultaneous equations, my friend

real range
real gradient = -4
real constant = 1200
real speed

set speed = (range - 1200) / (-4)

so, if range = 400..

speed = (400-1200) / (-4) = (-800 / -4) = 200

so, just use
speed = (range - constant) / gradient for your calculations of animation speed

Mathematics works!
y = mx + c

So, if y (range) == 343.31 then..

spd = (343.31 - 1200) / -4 = 214.1725
 

naughty

New Member
Reaction score
12
Now that is freakin awesome. I got a big headache yesterday trying to solve that out. +rep to you man
 
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