mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-08-15 10:47:21 +00:00
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:
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user