mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Merge branch 'develop'
This commit is contained in:
@@ -896,7 +896,7 @@ function UNIT:IsShip()
|
|||||||
end
|
end
|
||||||
|
|
||||||
--- Returns true if the UNIT is in the air.
|
--- 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 #boolean true if in the air.
|
||||||
-- @return #nil The UNIT is not existing or alive.
|
-- @return #nil The UNIT is not existing or alive.
|
||||||
function UNIT:InAir()
|
function UNIT:InAir()
|
||||||
@@ -908,11 +908,14 @@ function UNIT:InAir()
|
|||||||
-- Implementation of workaround. The original code is below.
|
-- Implementation of workaround. The original code is below.
|
||||||
-- This to simulate the landing on buildings.
|
-- This to simulate the landing on buildings.
|
||||||
-- local UnitInAir = DCSUnit:inAir()
|
-- local UnitInAir = DCSUnit:inAir()
|
||||||
local UnitInAir = false
|
local UnitInAir = true
|
||||||
local VelocityVec3 = DCSUnit:getVelocity()
|
local VelocityVec3 = DCSUnit:getVelocity()
|
||||||
local Velocity = ( VelocityVec3.x ^ 2 + VelocityVec3.y ^ 2 + VelocityVec3.z ^ 2 ) ^ 0.5 -- in meters / sec
|
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
|
local Coordinate = DCSUnit:getPoint()
|
||||||
UnitInAir = true
|
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
|
end
|
||||||
self:T3( UnitInAir )
|
self:T3( UnitInAir )
|
||||||
return UnitInAir
|
return UnitInAir
|
||||||
|
|||||||
Reference in New Issue
Block a user