Skip to content

Commit

Permalink
Use projVelY instead of _
Browse files Browse the repository at this point in the history
  • Loading branch information
lL1l1 committed Dec 3, 2024
1 parent 00b6ba7 commit 2821e42
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lua/sim/weapons/DefaultProjectileWeapon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down

0 comments on commit 2821e42

Please sign in to comment.