How Projectiles Are Behaving
In this guide we explain how projectiles are behaving and how the projectile speed work.
A projectile is another game object, it’s a mesh moving in space and it has the following specifications, for our case:
- Velocity
- Distancelimit
- Hitlifetime
- Misslifetime
An entity has a projectile speed which is actually a modifier:
- Projectilespeed
All units are guessed because there is no indication on what they are in the files, however the standard in video games is to use SI, so meters and seconds in our case.
The formulas to calculate the distance travelled are the following.
// Hit
Distance = (velocity * projectileSpeed) * HitLifetime
// Miss
Distance = (velocity * projectileSpeed) * MissLifetime
However, the game specifies a distance limit, so if the projectile distance is greater than the distanceLimit it will stop at the distanceLimit otherwise at distance. What passing through enemies means, is that the projectile is not stopped and use the MissLifetime instead of HitLifetime once it hits.
Example
I’ll use the default arrow.
Velocity 20 m/s
DistanceLimit 19 m
HitLifetime 2 s
MissLifetime 12 s
Distance = (velocity * projectileSpeed) * MissLifetime
120m = (20* 0.5) * 12 // If your `projectileSpeed` is 50%
240m = (20* 1.0) * 12 // If your `projectileSpeed` is 100%
360m = (20* 1.5) * 12 // If your `projectileSpeed` is 150%
480m = (20* 2.0) * 12 // If your `projectileSpeed` is 200%
I hope this was helpful to you!
Be the first to comment