Beispiel #1
0
        public static float AngleDifference(Vector3 pointOfView, Vector3 angle_1, Vector3 angle_2)
        {
            float deltaX = (float)Math.Sin(MathF.DegreesToRadians(angle_1.X - angle_2.X));
            float deltaY = (float)Math.Sin(MathF.DegreesToRadians(angle_1.Y - angle_2.Y));

            return((deltaX * deltaX + deltaY * deltaY) * pointOfView.Length());
        }
Beispiel #2
0
        public static float AngleDifference(float distance, Vector3 viewAngle, Vector3 targetAngle)
        {
            double pitch = Math.Sin(MathF.DegreesToRadians(viewAngle.X - targetAngle.X)) * distance;
            double yaw   = Math.Sin(MathF.DegreesToRadians(viewAngle.Y - targetAngle.Y)) * distance;

            return((float)Math.Sqrt(pitch * pitch + yaw * yaw));
        }
Beispiel #3
0
        public static float GetFov(Vector3 viewAngle, Vector3 targetAngle, float distance)
        {
            double deltaX = Math.Sin(MathF.DegreesToRadians(Math.Abs(viewAngle.X - targetAngle.X)));
            double deltaY = Math.Sin(MathF.DegreesToRadians(Math.Abs(viewAngle.Y - targetAngle.Y)));

            return((float)Math.Sin(deltaX * deltaX + deltaY * deltaY) * distance);
        }