From c2c78dfe78e88b16183d43c090cb7693b7a51d3b Mon Sep 17 00:00:00 2001 From: Shafik Date: Sun, 21 Dec 2025 09:15:44 +0200 Subject: [PATCH] [ADDED] Altitude AGL option for POSITIONABLE --- Moose Development/Moose/Wrapper/Positionable.lua | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/Moose Development/Moose/Wrapper/Positionable.lua b/Moose Development/Moose/Wrapper/Positionable.lua index 69c949429..e17602ca1 100644 --- a/Moose Development/Moose/Wrapper/Positionable.lua +++ b/Moose Development/Moose/Wrapper/Positionable.lua @@ -729,16 +729,23 @@ end --- Returns the altitude above sea level of the POSITIONABLE. -- @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 #nil The POSITIONABLE is not existing or alive. -function POSITIONABLE:GetAltitude() +function POSITIONABLE:GetAltitude(FromGround) self:F2() local DCSPositionable = self:GetDCSObject() if DCSPositionable then - local PositionablePointVec3 = DCSPositionable:getPoint() -- DCS#Vec3 - return PositionablePointVec3.y + local altitude = 0 + 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 BASE:E( { "Cannot GetAltitude", Positionable = self, Alive = self:IsAlive() } )