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


public class TestAgent : MonoBehaviour
{
    public Transform goal;
    //public float projectionDistance = 0.15f;

    NavMeshAgent agent;
    //Rigidbody rb;
    // Start is called before the first frame update
    void Start()
    {
        agent = GetComponent<NavMeshAgent>();

        //agent.updatePosition = false;
        //agent.updateRotation = false;
        //agent.updateUpAxis = false;

        //rb = GetComponent<Rigidbody>();
    }

    // Update is called once per frame
    void Update()
    {
        agent.SetDestination(goal.position);

        //if (Vector3.Distance(agent.nextPosition, transform.position) > projectionDistance)
        //    agent.nextPosition = transform.position;
    }

    private void FixedUpdate()
    {
        //if (agent.hasPath)
        //{
        //    rb.velocity = (agent.nextPosition - transform.position) * agent.speed;
        //}
    }
}
