From 2821e42d517ceaadd131a35d1dc2a524c0df3ea4 Mon Sep 17 00:00:00 2001 From: lL1l1 <82986251+lL1l1@users.noreply.github.com> Date: Tue, 3 Dec 2024 00:19:25 -0800 Subject: [PATCH] Use `projVelY` instead of `_` --- lua/sim/weapons/DefaultProjectileWeapon.lua | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/lua/sim/weapons/DefaultProjectileWeapon.lua b/lua/sim/weapons/DefaultProjectileWeapon.lua index 22f51ace84..c61e6bda52 100644 --- a/lua/sim/weapons/DefaultProjectileWeapon.lua +++ b/lua/sim/weapons/DefaultProjectileWeapon.lua @@ -202,12 +202,12 @@ DefaultProjectileWeapon = ClassWeapon(Weapon) { -- Get projectile position and velocity -- velocity will need to be multiplied by 10 due to being returned /tick instead of /s local projPosX, projPosY, projPosZ = EntityGetPositionXYZ(projectile) - local projVelX, _, projVelZ = UnitGetVelocity(launcher) + local projVelX, projVelY, projVelZ = UnitGetVelocity(launcher) -- The projectile will have velocity in the horizontal plane equal to the unit's 3 dimensional speed -- Multiply the XZ components by the ratio of the XYZ to XZ speeds to get the correct XZ components local projVelXZSquareSum = projVelX * projVelX + projVelZ * projVelZ - local multiplier = math.sqrt((projVelXZSquareSum + _ * _) / (projVelXZSquareSum)) + local multiplier = math.sqrt((projVelXZSquareSum + projVelY * projVelY) / (projVelXZSquareSum)) projVelX = projVelX * multiplier projVelZ = projVelZ * multiplier