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

public class PlayerTarget : MonoBehaviour
{
    [SerializeField] Camera Camera;
    [SerializeField] LayerMask ObstacleMask;

    private void Update()
    {
        if (!Input.GetMouseButton(1)) return;

        Move();
    }

    private void Move()
    {
        if (!Physics.Raycast(Camera.ScreenPointToRay(Input.mousePosition), out RaycastHit hitInfo, 999f, ObstacleMask)) return;

        transform.position = hitInfo.point;
    }
}
