예제 #1
0
        void GetListenerLocation(ref VRageMath.Vector3 position, ref VRageMath.Vector3 up, ref VRageMath.Vector3 forward)
        {
            // NOTICE: up vector is reverted, don't know why, I still have to investigate it
            if (MySession.LocalHumanPlayer != null && MySession.LocalHumanPlayer.Character != null)
            {
                position = MySession.LocalHumanPlayer.Character.WorldMatrix.Translation;
                up = -MySession.LocalHumanPlayer.Character.WorldMatrix.Up;
                forward = MySession.LocalHumanPlayer.Character.WorldMatrix.Forward;
            }
            else
                if (MySector.MainCamera != null)
                {
                    position = MySector.MainCamera.Position;
                    up = -MySector.MainCamera.UpVector;
                    forward = MySector.MainCamera.ForwardVector;
                }

            const float epsilon = 0.00001f;
            Debug.Assert(up.Dot(forward) < epsilon && Math.Abs(up.LengthSquared() - 1) < epsilon && Math.Abs(forward.LengthSquared() - 1) < epsilon, "Invalid direction vectors for audio");
        }
예제 #2
0
 void GetListenerLocation(ref VRageMath.Vector3 position, ref VRageMath.Vector3 up, ref VRageMath.Vector3 forward)
 {
     // NOTICE: up vector is reverted, don't know why, I still have to investigate it
     if (MySector.MainCamera != null)
     {
         if (MySession.Static != null && MySession.Static.LocalCharacter != null && MySession.Static.CameraController == MySession.Static.LocalCharacter)
             position = MySession.Static.LocalCharacter.PositionComp.GetPosition();
         else
         position = MySector.MainCamera.Position;
         // PARODY
         up = -Vector3D.Normalize(MySector.MainCamera.UpVector);
         forward = Vector3D.Normalize(MySector.MainCamera.ForwardVector);
     }
     const float epsilon = 0.00005f;
     Debug.Assert(up.Dot(forward) < epsilon && Math.Abs(up.LengthSquared() - 1) < epsilon && Math.Abs(forward.LengthSquared() - 1) < epsilon, "Invalid direction vectors for audio");
 }