• Check out the results of the Techtree Contest #19!
  • Listen to a special audio message from Bill Roper to the Hive Workshop community (Bill is a former Vice President of Blizzard Entertainment, Producer, Designer, Musician, Voice Actor) 🔗Click here to hear his message!
  • Read Evilhog's interview with Gregory Alper, the original composer of the music for WarCraft: Orcs & Humans 🔗Click here to read the full interview.
  • Create a void inspired texture for Warcraft 3 and enter Hive's 34th Texturing Contest: Void! Click here to enter!
  • The Hive's 22nd Icon Contest: Creep Abilities is now concluded, time to vote for your favourite set of icons! Click here to vote!

[JASS] Need a math question

Status
Not open for further replies.
Level 18
Joined
Oct 18, 2007
Messages
929
Ok im stuck in a spell, as usual... So i need a result that gives me the correct real value that the unit is moved every interval. In the end it will match up to the time. The end result will be ' S ' ( Speed )

The variables you are given is this.
  1. Real value ' D ' ( Distance )
  2. Real value ' T ' ( Time it takes )
  3. real value ' I ' ( Interval )

The object(unit) ' U ' is moved every interval ' I ' with speed ' S ' for a distace of ' D ' over time ' T '.
 
But... if you want the current time, either, just increase a real (lets call it Tinc) everytime you run the loop: At beginning: Tinc = 0, at every loop Tinc = Tinc + Interval
or, if you have the distance increasing every interval: Tinc = Dcurrent/Speed
 
But... if you want the current time, either, just increase a real (lets call it Tinc) everytime you run the loop: At beginning: Tinc = 0, at every loop Tinc = Tinc + Interval
or, if you have the distance increasing every interval: Tinc = Dcurrent/Speed

no, you dont understand :P I Want the unit to move at a calculated value each interval. It will move a distance over a given time.

Fack, i mean you will not be given a speed :P

( Read the first post again, updated the info )
 
Oh, I see what this guy wants. Basically, you're given the total distance over which the unit travels and the time it takes for that unit to travel the distance. This guy wants the speed, it's really quite simple.

The unit moves at a rate of 'S' per 'I', right? So if we were to take the number of intervals, 'I', and multiply it by 'S', we would get the total distance. Right?

D = SI, or S = D/I

And obviously,

T = DS, or T = (S^2)I

Did that help?
 
Oh, I see what this guy wants. Basically, you're given the total distance over which the unit travels and the time it takes for that unit to travel the distance. This guy wants the speed, it's really quite simple.

The unit moves at a rate of 'S' per 'I', right? So if we were to take the number of intervals, 'I', and multiply it by 'S', we would get the total distance. Right?

D = SI, or S = D/I

And obviously,

T = DS, or T = (S^2)I

Did that help?

hmm, not right on the interval thing. The interval is the every sec it moves. If the interval os 0.035 then it will move every 0.035 seconds
 
So we need to figure out how many intervals there are in the total time. That's T/I.

Let's call the number of intervals, 'N'. Replace I in my original equations by N. You're done.

D = ST/I
S = DI/T
 
Last edited:
Like I said to Dynasti in the chat

S = D / (T * (1 / I))

1 / I - converts the interval to frames per second
T * (1 / I) - time dependent on the fps
D / T - just a normal calculation for speed

Example:
D = 1000
T = 5
I = 0.05

S = 1000 / (5 * (1 / 0.05)) = 1000 / (5 * 20) = 1000 / 100 = 10;

Explanation:
Moves FPS*10 each second = 20*10 = Moves 200 every second = 1000 in 5 seconds.
 
Status
Not open for further replies.
Back
Top