This commit is contained in:
Applevangelist 2025-03-02 12:39:25 +01:00
parent 25845c4d22
commit 79e7f9940e

View File

@ -1227,11 +1227,14 @@ function GROUP:GetCoordinate()
-- First try to get the 3D vector of the group. This uses -- First try to get the 3D vector of the group. This uses
local vec3=self:GetVec3() local vec3=self:GetVec3()
local coord
if vec3 then if vec3 then
local coord=COORDINATE:NewFromVec3(vec3) coord=COORDINATE:NewFromVec3(vec3)
coord.Heading = self:GetHeading() or 0
return coord return coord
end end
-- No luck try units and add Heading data
local Units = self:GetUnits() or {} local Units = self:GetUnits() or {}
for _,_unit in pairs(Units) do for _,_unit in pairs(Units) do
@ -1242,15 +1245,15 @@ function GROUP:GetCoordinate()
local FirstUnitCoordinate = FirstUnit:GetCoordinate() local FirstUnitCoordinate = FirstUnit:GetCoordinate()
if FirstUnitCoordinate then if FirstUnitCoordinate then
local Heading = self:GetHeading() local Heading = self:GetHeading() or 0
FirstUnitCoordinate.Heading = Heading FirstUnitCoordinate.Heading = Heading
return FirstUnitCoordinate return FirstUnitCoordinate
end end
end end
end end
-- no luck, try the API way
-- no luck, try the API way
local DCSGroup = Group.getByName(self.GroupName) local DCSGroup = Group.getByName(self.GroupName)
if DCSGroup then if DCSGroup then
local DCSUnits = DCSGroup:getUnits() or {} local DCSUnits = DCSGroup:getUnits() or {}
@ -1261,6 +1264,11 @@ function GROUP:GetCoordinate()
if point then if point then
--self:I(point) --self:I(point)
local coord = COORDINATE:NewFromVec3(point) local coord = COORDINATE:NewFromVec3(point)
coord.Heading = 0
local munit = UNIT:Find(_unit)
if munit then
coord.Heading = munit:GetHeading() or 0
end
return coord return coord
end end
end end