示例#1
0
        /// <summary> Sets the Pitch and Yaw angles by a heading-at vector. Roll is 0. </summary>
        public void SetByAtVector(Vec3f at)
        {
            at    = at.Normalise();
            Pitch = -(float)Math.Acos(at.Y) + PI / 2; // +PI/2 so the default value is 0 and not -90
            Pitch = ClampToPI(Pitch);

            Yaw  = (float)Math.Atan2(-at.X, at.Z);
            Roll = 0;
        }
示例#2
0
 public static float GetYawFromAtVector(Vec3f at)
 {
     at = at.Normalise();
     return((float)Math.Atan2(-at.X, at.Z));
 }