Ejemplo n.º 1
0
        private bool IsPositionInTurretArch(Vector3D point)
        {
            AzimuthAndElevation ori = GetTargetAzimuthElevation(point);

            if (IsAzimuthLimited)
            {
                if (ori.Azimuth > MaxAzimuthRadians || ori.Azimuth < MinAzimuthRadians)
                {
                    return(false);
                }
            }

            if (IsElevationLimited)
            {
                if (ori.Elevation > MaxElevationRadians || ori.Elevation < MinElevationRadians)
                {
                    return(false);
                }
            }

            return(true);
        }
Ejemplo n.º 2
0
        private float LookAt(Vector3D target)
        {
            AzimuthAndElevation ori = GetTargetAzimuthElevation(target);

            float elevationAngleDifference = ori.Elevation - Elevation;
            float azimuthAngleDifference   = ori.Azimuth - Azimuth;

            float azimuthTravel = MathHelper.Clamp(azimuthAngleDifference, -AzimuthSpeedPerTick, AzimuthSpeedPerTick);

            if (Math.Abs(azimuthAngleDifference) < Math.PI)
            {
                Azimuth = Azimuth + azimuthTravel;
            }
            else
            {
                Azimuth = Azimuth - azimuthTravel;
            }

            Elevation = Elevation + MathHelper.Clamp(elevationAngleDifference, -ElevationSpeedPerTick, ElevationSpeedPerTick);
            Azimuth   = MathHelper.WrapAngle(Azimuth);

            return((azimuthAngleDifference > elevationAngleDifference) ? azimuthAngleDifference : elevationAngleDifference);
        }