Beispiel #1
0
        public void RotateAroundLookPositionWorld(Vector3 radians)
        {
            var matrix = Matrix3.Identity;

            matrix = matrix.RotateAroundWorldAxisX(radians.X);
            matrix = matrix.RotateAroundWorldAxisY(radians.Y);
            matrix = matrix.RotateAroundWorldAxisZ(radians.Z);

            Position -= LookAtPosition;
            Position  = Position.Transform(matrix);
            Position += LookAtPosition;

            UpPosition -= LookAtPosition;
            UpPosition  = UpPosition.Transform(matrix);
            UpPosition += LookAtPosition;
        }
Beispiel #2
0
        public void RotateAroundPosition(Vector3 radians)
        {
            var matrix          = Matrix3.LookAt((LookAtPosition - Position), (UpPosition - Position));
            var matrixTranspose = matrix.Transpose();

            matrix = matrix.RotateAroundAxisX(radians.X);
            matrix = matrix.RotateAroundAxisY(radians.Y);
            matrix = matrix.RotateAroundAxisZ(radians.Z);

            LookAtPosition -= Position;
            LookAtPosition  = LookAtPosition.Transform(matrixTranspose);
            LookAtPosition  = LookAtPosition.Transform(matrix);
            LookAtPosition += Position;

            UpPosition -= Position;
            UpPosition  = UpPosition.Transform(matrixTranspose);
            UpPosition  = UpPosition.Transform(matrix);
            UpPosition += Position;
        }