• 🏆 Texturing Contest #33 is OPEN! Contestants must re-texture a SD unit model found in-game (Warcraft 3 Classic), recreating the unit into a peaceful NPC version. 🔗Click here to enter!
  • It's time for the first HD Modeling Contest of 2024. Join the theme discussion for Hive's HD Modeling Contest #6! Click here to post your idea!

Interesting Bullet Height SIMPLE Math!

Status
Not open for further replies.
Level 10
Joined
Sep 21, 2007
Messages
517
Alright guys, basically i was scouring for a function that works correctly for Z height movement for the bullet, as usual, i failed, then i found Diablo-Dks suggestion which had a bit of math it was something like sin(ZAxis)*speed or something like that, anyhow, i failed at getting the ZAxis and even looked at Cartesian 3D Plane, and failed at at also... then i went to the very basic laws of physics, T = D/S, so what i did was get the time between the two distances, T = D/S, then i had a variable for the Z difference between the target location and the beginning location, which gets the correct height transition i needed, now after that i here is what i did

i checked if z2 is greater than z1 or not, then

if z1 is greater than z2 then set dz (the height difference) = dz + (dz/T)
else set dz = dz + (dz*T)

NOw the final step
depending on the interval of the timer, which moves the unit every INTERVAL seconds... set dz = dz*INTERVAL

now to make it go in a linear line, just do this to height, every interval, set unit height = unit height + dz, make sure the bullet or particle or w/e has an initial height of w/e so it can launch correctly (depends on how tall your unit is where you want to shoot, for example, for rifle man an initial height of 50 or 75 would be good since it looks like he shoots from his gun )

Thats all folks! hope i helped anyone strugglign with these issues... but please know this doesnt work as effectively as other mathematical algorythms, i just came up with this.
 
Level 11
Joined
Feb 16, 2009
Messages
760
Are you using JASS or GUI? If you use GUI I suggest learning a bit, because its easier to make formulas with. Also, you could look at some jump systems from the spell section.
Also, the new hashtables allow you to attach a lot of data to units, so use that!
 
Level 10
Joined
Sep 21, 2007
Messages
517
im using jass now but i know how to use both, anyhow, this is linear movement, not using a parabola formula, and i know how to attach data to units, im just trying to present a simple mathematical solution to those who may need it. and u dont need to use hashtables, unless if ur creating a really bad-ass particle system, unless if ur using it without directly referncing it to handle, itll be much faster, like vexorians Table. (can be done both GUI and JASS)
 
Status
Not open for further replies.
Top