Frag Posted September 18, 2018 Share Posted September 18, 2018 (edited) Guys, with moose, is there a way to get the altitude over the ground instead of the barometric one delivered by UNIT:GetAltitude() ? Seems like GetHeight() for the unit return the same value as GetAltitude Pretty sure there is, but I cannot figure it out ... Example: If my chopper is hovering at 2 meters over the ground, then I want this method to return 2. Thanks Edited September 18, 2018 by Frag Link to comment Share on other sites More sharing options...
Frag Posted September 18, 2018 Author Share Posted September 18, 2018 Ok ... had to code it myself by pulling out the unit coordinate and substract the terrain height. If there is a shorter way or a direct property call let me know ... In the following code snipet, "l39" is a l39 player plane in the editor local uPlayer = UNIT:FindByName("l39") local coorPlayer = uPlayer:GetCoordinate() local groundAltitude = uPlayer:GetAltitude() - coorPlayer:GetLandHeight() Link to comment Share on other sites More sharing options...
Hardcard Posted September 18, 2018 Share Posted September 18, 2018 (edited) UNIT functionality in MOOSE is limited, you can do considerably more stuff at GROUP level. This is probably what you were looking for: GROUP:GetHeight(FromGround) Returns the average group height in meters. Parameter •#boolean FromGround : Measure from the ground or from sea level. Provide true for measuring from the ground. false or nil if you measure from sea level. Return values 1.DCS#Vec3: The height of the group. 2.#nil: The GROUP is not existing or alive. The solution you found seems nice enough, though. Maybe "GROUP:GetHeight(true)" uses a similar method to find the value. Edited September 18, 2018 by Hardcard [sIGPIC][/sIGPIC] Link to comment Share on other sites More sharing options...
Grimes Posted September 18, 2018 Share Posted September 18, 2018 Because knowledge is power and knowing is half the battle. local pos = Unit.getByName('whatever'):getPoint() local agl = pos.y - land.getHeight({x=pos.x, y = pos.z}) The right man in the wrong place makes all the difference in the world. Current Projects: Grayflag Server, Scripting Wiki Useful Links: Mission Scripting Tools MIST-(GitHub) MIST-(Thread) SLMOD, Wiki wishlist, Mission Editing Wiki!, Mission Building Forum Link to comment Share on other sites More sharing options...
Frag Posted September 18, 2018 Author Share Posted September 18, 2018 UNIT functionality in MOOSE is limited, you can do considerably more stuff at GROUP level. This is probably what you were looking for: GROUP:GetHeight(FromGround) Returns the average group height in meters. Parameter •#boolean FromGround : Measure from the ground or from sea level. Provide true for measuring from the ground. false or nil if you measure from sea level. Return values 1.DCS#Vec3: The height of the group. 2.#nil: The GROUP is not existing or alive. The solution you found seems nice enough, though. Maybe "GROUP:GetHeight(true)" uses a similar method to find the value. I wonder, a group can hold more than one unit. So you will agree that the unit could be at different altitude ... what would be returned then? I already fixed the issue but your answer made me realized that I may miss something. Link to comment Share on other sites More sharing options...
Hardcard Posted September 18, 2018 Share Posted September 18, 2018 (edited) GROUP:GetHeight(FromGround) Returns the [u][b]average[/b][/u] group height in meters What some MOOSE users do (myself included) is create a separate group for each unit, that way we can use GROUP functionalities with individual UNITs (then use SETs to target all those single-unit groups at once). So, in this case, this would return the height of your L39 (since it's the only unit in the group, the average height of the group would be the actual height of that L39 unit), which should be good enough for what you wanted to accomplish. It's either that or finding workarounds, like you did. Anyway, you can always do what Grimes suggested, his scripting Wiki is quite useful, you can combine it with MOOSE without problems (as far as I know). Edited September 18, 2018 by Hardcard [sIGPIC][/sIGPIC] Link to comment Share on other sites More sharing options...
Frag Posted September 18, 2018 Author Share Posted September 18, 2018 Thanks for all the answers guys, it does all make sense now. Link to comment Share on other sites More sharing options...
Recommended Posts