mirror of
https://github.com/FlightControl-Master/MOOSE.git
synced 2025-10-29 16:58:06 +00:00
Fixed Offset issue.
This commit is contained in:
parent
07aff74126
commit
6b04237a3f
@ -1040,10 +1040,10 @@ ZONE_UNIT = {
|
|||||||
-- theta The azimuth of the zone relative to unit
|
-- theta The azimuth of the zone relative to unit
|
||||||
-- relative_to_unit If true, theta is measured clockwise from unit's direction else clockwise from north. If using dx, dy setting this to true makes +x parallel to unit heading.
|
-- relative_to_unit If true, theta is measured clockwise from unit's direction else clockwise from north. If using dx, dy setting this to true makes +x parallel to unit heading.
|
||||||
-- dx, dy OR rho, theta may be used, not both.
|
-- dx, dy OR rho, theta may be used, not both.
|
||||||
|
|
||||||
-- @return #ZONE_UNIT self
|
-- @return #ZONE_UNIT self
|
||||||
function ZONE_UNIT:New( ZoneName, ZoneUNIT, Radius, Offset)
|
function ZONE_UNIT:New( ZoneName, ZoneUNIT, Radius, Offset)
|
||||||
|
|
||||||
|
if Offset then
|
||||||
-- check if the inputs was reasonable, either (dx, dy) or (rho, theta) can be given, else raise an exception.
|
-- check if the inputs was reasonable, either (dx, dy) or (rho, theta) can be given, else raise an exception.
|
||||||
if (Offset.dx or Offset.dy) and (Offset.rho or Offset.theta) then
|
if (Offset.dx or Offset.dy) and (Offset.rho or Offset.theta) then
|
||||||
error("Cannot use (dx, dy) with (rho, theta)")
|
error("Cannot use (dx, dy) with (rho, theta)")
|
||||||
@ -1054,6 +1054,7 @@ function ZONE_UNIT:New( ZoneName, ZoneUNIT, Radius, Offset)
|
|||||||
self.rho = Offset.rho or 0.0
|
self.rho = Offset.rho or 0.0
|
||||||
self.theta = (Offset.theta or 0.0) * math.pi / 180.0
|
self.theta = (Offset.theta or 0.0) * math.pi / 180.0
|
||||||
self.relative_to_unit = Offset.relative_to_unit or false
|
self.relative_to_unit = Offset.relative_to_unit or false
|
||||||
|
end
|
||||||
|
|
||||||
local self = BASE:Inherit( self, ZONE_RADIUS:New( ZoneName, ZoneUNIT:GetVec2(), Radius ) )
|
local self = BASE:Inherit( self, ZONE_RADIUS:New( ZoneName, ZoneUNIT:GetVec2(), Radius ) )
|
||||||
|
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user