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

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

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

            Position -= UpPosition;
            Position  = Position.Transform(matrix);
            Position += UpPosition;
        }
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;
        }