| 01-29-2009, 03:30 AM | #1 |
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 |
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 |
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 |
To get "same arc" you need at least function used by standart projectiles. |
| 01-29-2009, 05:22 AM | #5 |
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 |
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 |
JASS:function ArcZ takes real d, real x, real arc returns real return (4 * arc) * (d - x) * (x / d) endfunction But how would I change that to initial z velocity and z acceleration ? |
| 01-29-2009, 10:51 AM | #8 |
Vex's Caster System already has this implemented in his projectile functions, have a look there |
| 01-29-2009, 12:59 PM | #9 | |
Quote:
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 | |
Quote:
|
| 01-29-2009, 10:52 PM | #11 |
JASS:function ArcZ takes real d, real t, real arc returns real return (4 * arc) * (d - (t*d)) * t endfunction And I don't know how to differentiate :o |
| 01-30-2009, 12:14 AM | #12 | |
Quote:
No, I would use speed as a new parameter to get from time to location. So you would just replace x with (time*speed) 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 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 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 |
Ok thanks |
