Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix bombers missing during vertical movement #6572

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog/snippets/fix.6572.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
- (#6572) Fix bombers missing when bombing while changing altitude.
11 changes: 9 additions & 2 deletions lua/sim/weapons/DefaultProjectileWeapon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,16 @@ 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)

local targetPos
-- 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 + projVelY * projVelY) / (projVelXZSquareSum))
projVelX = projVelX * multiplier
projVelZ = projVelZ * multiplier

local targetPos, _
local targetVelX, targetVelZ = 0, 0

local data = self.CurrentSalvoData
Expand Down
Loading