Implemented workaround request to board and unboard cargo from buildings. Now "InAir" means a velocity < 1 m/s and a height < 30 m. Once DCS properly fixes the flag to land on buildings, this workaround can be removed.

This commit is contained in:
FlightControl
2018-10-12 07:14:05 +02:00
parent 08c593578f
commit 690805d7ca
2 changed files with 31 additions and 18 deletions

View File

@@ -902,10 +902,18 @@ end
function UNIT:InAir()
self:F2( self.UnitName )
local DCSUnit = self:GetDCSObject()
local DCSUnit = self:GetDCSObject() --DCS#Unit
if DCSUnit then
local UnitInAir = DCSUnit:inAir()
-- Implementation of workaround. The original code is below.
-- This to simulate the landing on buildings.
-- local UnitInAir = DCSUnit:inAir()
local UnitInAir = false
local VelocityVec3 = DCSUnit:getVelocity()
local Velocity = ( VelocityVec3.x ^ 2 + VelocityVec3.y ^ 2 + VelocityVec3.z ^ 2 ) ^ 0.5 -- in meters / sec
if Velocity < 1 and DCSUnit:getPoint().y <= 30 then
UnitInAir = true
end
self:T3( UnitInAir )
return UnitInAir
end