示例#1
0
        /// <summary>
        /// Gets a unit-vector pointing in the direction that this Location is facing.
        /// </summary>
        /// <returns>A vector pointing the direction of this location's Pitch and Yaw</returns>
        public Vector GetDirection()
        {
            Vector vector = new Vector();

            double rotX = Yaw;
            double rotY = Pitch;

            vector.SetY(-Math.Sin(MathE.ToRadians(rotY)));

            double xz = Math.Cos(MathE.ToRadians(rotY));

            vector.SetX(-xz * Math.Sin(MathE.ToRadians(rotX)));
            vector.SetZ(xz * Math.Cos(MathE.ToRadians(rotX)));

            return(vector);
        }