• 🏆 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!

Projectile Height

Status
Not open for further replies.
Level 24
Joined
Feb 9, 2009
Messages
1,787
Whats a good formula for projectile height modification?
Ex:
>Missile gaining height to hit a flying enemy from the flying height of a footman?
Just smooth ascent or descent based on the distance, or dynamic distance in case the unit travels.

Peace, Love and Understanding, thank you!
 
Level 39
Joined
Feb 27, 2007
Messages
5,013
If you don’t care about it being parabolic:

Hdiff = tgtFlyHeight - srcFlyHeight
Ddiff = distance between tgt and src
Dremain = distance between tgt and missile

H = srcFlyHeight + Hdiff*Dremain/Ddiff

Instead of checking against current src location you can set the launch location once and re-use it. It’s still possible the missile appears to go down during this if the tgt moves very quickly away from the missile faster than the missile moves in the xy plane.
 
Status
Not open for further replies.
Top