HomeUser Control Panel (unavailable in archive)ForumsTutorialsArt GalleryResourcesMaps

Attack Arc

01-29-2009, 03:30 AM#1
Bobo_The_Kodo
How do you calculate the initial z velocity and z acceleration of a projectile based on distance, speed, and arc ? (max height = distance * arc)

Just like the warcraft projectiles arc
01-29-2009, 03:58 AM#2
DioD
You cant copy warcraft 3 projectile system, this data stored insise game.dll and cannot be extracted.

Also you cant get any data from projectiles.
01-29-2009, 04:04 AM#3
Bobo_The_Kodo
I didn't say anything about warcraft 3 projectile system other than I want my projectiles to have the same arc thing as them .
01-29-2009, 05:06 AM#4
DioD
To get "same arc" you need at least function used by standart projectiles.
01-29-2009, 05:22 AM#5
Bobo_The_Kodo
In theirs the arc * distance = maxheight, thats what I'm saying I want... nothing needs to be extracted
01-29-2009, 05:33 AM#6
TEC_Ghost
Just make an arc algorithm and test it out with different values till you find the one that WC3 uses.
01-29-2009, 07:30 AM#7
Bobo_The_Kodo
Collapse JASS:
function ArcZ takes real d, real x, real arc returns real
  return (4 * arc) * (d - x) * (x / d)
endfunction
^ im pretty sure its that
But how would I change that to initial z velocity and z acceleration ?
01-29-2009, 10:51 AM#8
PandaMine
Vex's Caster System already has this implemented in his projectile functions, have a look there
01-29-2009, 12:59 PM#9
peq
Quote:
Originally Posted by Bobo_The_Kodo
Collapse JASS:
function ArcZ takes real d, real x, real arc returns real
  return (4 * arc) * (d - x) * (x / d)
endfunction
^ im pretty sure its that
But how would I change that to initial z velocity and z acceleration ?

First make it function of time instead of location.

Then differentiate with respect to time to get the function of the velocity. Differentiate aggain to get the function of acceleration.

(then set time = 0 to get the initial velocity, acceleration should be a constant)
01-29-2009, 01:42 PM#10
Vexorian
Quote:
Originally Posted by PandaMine
Vex's Caster System already has this implemented in his projectile functions, have a look there
There I use arc as acceleration, I think I multiply it by a factor of 1600 for it to look similar, but it is quite an approximation, maybe the other theories are more accurate.
01-29-2009, 10:52 PM#11
Bobo_The_Kodo
Collapse JASS:
function ArcZ takes real d, real t, real arc returns real
  return (4 * arc) * (d - (t*d)) * t
endfunction
Like that Peq ?

And I don't know how to differentiate :o
01-30-2009, 12:14 AM#12
peq
Quote:
Originally Posted by Bobo_The_Kodo
Collapse JASS:
function ArcZ takes real d, real t, real arc returns real
  return (4 * arc) * (d - (t*d)) * t
endfunction
Like that Peq ?

And I don't know how to differentiate :o

No, I would use speed as a new parameter to get from time to location. So you would just replace x with (time*speed)
Collapse JASS:
function ArcZ takes real t, real speed, real arc, real d returns real
  return (4 * arc) * (d - (t*speed)) * ((t*speed) / d)
endfunction

To differentiate just write your formula in an other way:

4*arc*speed * (t - speed/d * t^2)

Differentiation is very easy in this case as you just have to use the most basic rule:
- look at each part with a t and look at the exponent.

First Part: t , exponent 1
Second Part: - speed/d * t^2, exponent 2

you can ignore 4*arc*speed as does not change with time, so just keep it as a factor.
Then just use this rule: decrease exponent by 1 and multiply by the (old) exponent.

For the first part:
1*t^0 = 1

And for the second part:
2* (- speed/d *) * t^1 = -2*speed/d*t

So the formula for the velocity would be
Collapse JASS:
function ArcZVelocity takes real t, real speed, real arc, read d returns real
  return 4*arc*speed*( 1 -2*speed/d*t)
endfunction

and for accelertion
Collapse JASS:
function ArcZAccelertion takes real t, real speed, real arc, real d returns real
  return -8*arc*speed*speed/d
endfunction
01-30-2009, 01:30 AM#13
Bobo_The_Kodo
Ok thanks