Need help with stopping a ship object from rotating to face mouse pointer when mouse is close enough to the ship object.

Hello, i am a noob and have been trying for the whole day now and have gotten nowhere in this area.

This is the (mostly base) rotate script which i put into a separate script to be called in the player controller. (The actual mouse facing code is from indie nuggets on youtube.)

(Sidenote: Is there any nifty way i can use logical operators or compare vector3s?
Something like v1 > v2 or v1.y > v2.y–or something like that?)

using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class MouseTracking : MonoBehaviour{
    private static PlayerController playerObject = PlayerController.Instance;

    public static float allowAimRadius = 1f;

    public static void ShipAim2D()
    {
        Vector3 vAimRadius = new Vector3(allowAimRadius, allowAimRadius, 0);

        Vector3 dir = Input.mousePosition - Camera.main.WorldToScreenPoint(playerObject.transform.position);
        float angle = (Mathf.Atan2(dir.y, dir.x) * Mathf.Rad2Deg) - 90;
        playerObject.transform.rotation = Quaternion.AngleAxis(angle, Vector3.forward);
    }

}

Add a trigger collider to the ship and a bool to the rotator script. During an OnTriggerEnter method set the bool to true if the trigger is the ship’s trigger collider (use tags or layers) and during an OnTriggerExit set the bool back to false. During whatever method you’re calling the aiming method from add a check for the bool and only perform the action if it’s false.