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

public class PlayerCT : MonoBehaviour
{

public LayerMask movementMask;
NavMeshAgent navMeshAgent;

// Start is called before the first frame update
void Start()
{
    animator = this.transform.GetComponent<Animator>();
    navMeshAgent = GetComponent<NavMeshAgent>();
}

// Update is called once per frame
void Update()
{
    if (Input.GetMouseButtonDown(1))
    {
        Ray ray = Camera.main.ScreenPointToRay(Input.mousePosition);
        RaycastHit hit;
        if (!Physics.Raycast(ray, out hit,100,movementMask))
        {
            //hit.collider .gameObject //射线打到的物体
            return;
        }
        navMeshAgent.destination = hit.point;
    }
}

}