internal void InitTracking() { RotationSpeed = System.AzStep; ElevationSpeed = System.ElStep; var minAz = System.MinAzimuth; var maxAz = System.MaxAzimuth; var minEl = System.MinElevation; var maxEl = System.MaxElevation; var toleranceRads = MathHelperD.ToRadians(System.Values.HardPoint.AimingTolerance); MinElevationRadians = MinElToleranceRadians = MathHelperD.ToRadians(MathFuncs.NormalizeAngle(minEl)); MaxElevationRadians = MaxElToleranceRadians = MathHelperD.ToRadians(MathFuncs.NormalizeAngle(maxEl)); MinAzimuthRadians = MinAzToleranceRadians = MathHelperD.ToRadians(MathFuncs.NormalizeAngle(minAz)); MaxAzimuthRadians = MaxAzToleranceRadians = MathHelperD.ToRadians(MathFuncs.NormalizeAngle(maxAz)); if (System.TurretMovement == WeaponSystem.TurretType.AzimuthOnly || System.Values.HardPoint.AddToleranceToTracking) { MinElToleranceRadians -= toleranceRads; MaxElToleranceRadians += toleranceRads; } else if (System.TurretMovement == WeaponSystem.TurretType.ElevationOnly || System.Values.HardPoint.AddToleranceToTracking) { MinAzToleranceRadians -= toleranceRads; MaxAzToleranceRadians += toleranceRads; } if (MinElToleranceRadians > MaxElToleranceRadians) { MinElToleranceRadians -= 6.283185f; } if (MinAzToleranceRadians > MaxAzToleranceRadians) { MinAzToleranceRadians -= 6.283185f; } var dummyInfo = Dummies[MiddleMuzzleIndex]; MuzzleDistToBarrelCenter = Vector3D.Distance(dummyInfo.Info.Position, dummyInfo.Entity.PositionComp.WorldAABB.Center); }
internal void InitTracking() { RotationSpeed = System.AzStep; ElevationSpeed = System.ElStep; var minAz = System.MinAzimuth; var maxAz = System.MaxAzimuth; var minEl = System.MinElevation; var maxEl = System.MaxElevation; MinElevationRadians = MathHelperD.ToRadians(MathFuncs.NormalizeAngle(minEl)); MaxElevationRadians = MathHelperD.ToRadians(MathFuncs.NormalizeAngle(maxEl)); var toleranceRads = MathHelperD.ToRadians(System.Values.HardPoint.AimingTolerance); if (MinElevationRadians > MaxElevationRadians) { MinElevationRadians -= 6.283185f; } MinAzimuthRadians = MathHelperD.ToRadians(MathFuncs.NormalizeAngle(minAz)); MaxAzimuthRadians = MathHelperD.ToRadians(MathFuncs.NormalizeAngle(maxAz)); if (System.TurretMovement == WeaponSystem.TurretType.AzimuthOnly) { MinElevationRadians -= toleranceRads; MaxElevationRadians += toleranceRads; } else if (System.TurretMovement == WeaponSystem.TurretType.ElevationOnly) { MinAzimuthRadians -= toleranceRads; MaxAzimuthRadians += toleranceRads; } if (MinAzimuthRadians > MaxAzimuthRadians) { MinAzimuthRadians -= 6.283185f; } }