Merge branch 'develop'

This commit is contained in:
FlightControl 2018-10-12 20:20:16 +02:00
commit 4386b19b06

View File

@ -896,7 +896,7 @@ function UNIT:IsShip()
end
--- Returns true if the UNIT is in the air.
-- @param Wrapper.Positionable#UNIT self
-- @param #UNIT self
-- @return #boolean true if in the air.
-- @return #nil The UNIT is not existing or alive.
function UNIT:InAir()
@ -908,11 +908,14 @@ function UNIT:InAir()
-- Implementation of workaround. The original code is below.
-- This to simulate the landing on buildings.
-- local UnitInAir = DCSUnit:inAir()
local UnitInAir = false
local UnitInAir = true
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
local Coordinate = DCSUnit:getPoint()
local LandHeight = land.getHeight( { x = Coordinate.x, y = Coordinate.z } )
local Height = Coordinate.y - LandHeight
if Velocity < 1 and Height <= 30 then
UnitInAir = false
end
self:T3( UnitInAir )
return UnitInAir