mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2026-08-13 09:16:15 +00:00
@@ -729,16 +729,23 @@ end
|
|||||||
|
|
||||||
--- Returns the altitude above sea level of the POSITIONABLE.
|
--- Returns the altitude above sea level of the POSITIONABLE.
|
||||||
-- @param #POSITIONABLE self
|
-- @param #POSITIONABLE self
|
||||||
|
-- @param #boolean FromGround Measure from the ground or from sea level (ASL). Provide **true** for measuring from the ground (AGL). **false** or **nil** if you measure from sea level.
|
||||||
-- @return DCS#Distance The altitude of the POSITIONABLE.
|
-- @return DCS#Distance The altitude of the POSITIONABLE.
|
||||||
-- @return #nil The POSITIONABLE is not existing or alive.
|
-- @return #nil The POSITIONABLE is not existing or alive.
|
||||||
function POSITIONABLE:GetAltitude()
|
function POSITIONABLE:GetAltitude(FromGround)
|
||||||
self:F2()
|
self:F2()
|
||||||
|
|
||||||
local DCSPositionable = self:GetDCSObject()
|
local DCSPositionable = self:GetDCSObject()
|
||||||
|
|
||||||
if DCSPositionable then
|
if DCSPositionable then
|
||||||
local PositionablePointVec3 = DCSPositionable:getPoint() -- DCS#Vec3
|
local altitude = 0
|
||||||
return PositionablePointVec3.y
|
local point = DCSPositionable:getPoint() --DCS#Vec3
|
||||||
|
altitude = point.y
|
||||||
|
if FromGround then
|
||||||
|
local land = land.getHeight({ x = point.x, y = point.z }) or 0
|
||||||
|
altitude = altitude - land
|
||||||
|
end
|
||||||
|
return altitude
|
||||||
end
|
end
|
||||||
|
|
||||||
BASE:E( { "Cannot GetAltitude", Positionable = self, Alive = self:IsAlive() } )
|
BASE:E( { "Cannot GetAltitude", Positionable = self, Alive = self:IsAlive() } )
|
||||||
|
|||||||
Reference in New Issue
Block a user