using UnityEngine;
using UnityEngine.Serialization;

public class MouseWorld : MonoBehaviour {
    private static MouseWorld instance;

    [FormerlySerializedAs("MousePlaneLayerMask")] [SerializeField]
    private LayerMask mousePlaneLayerMask;

    private void Awake() => instance = this;

    public static Vector3 GetPosition() {
        Ray ray = Camera.main.ScreenPointToRay(InputManager.Instance.GetMouseScreenPosition());
        Physics.Raycast(ray, out RaycastHit raycastHit, float.MaxValue, instance.mousePlaneLayerMask);
        return raycastHit.point;
    }
}