Newer
Older
Dreamsturbia-Project-IADE-Unity3D / Assets / Scripts / AI / Navmesh / NavMeshAgentExtension.cs
@Rackday Rackday on 21 Aug 513 bytes Project Added
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.AI;

public static class NavMeshAgentExtension
{
    public static bool IsAtDestination(this NavMeshAgent a)
    {
        if (!a.pathPending)
        {
            if (a.remainingDistance <= (a.stoppingDistance))
            {
                if (!a.hasPath || a.velocity.sqrMagnitude == 0)
                {
                    return true;
                }
            }
        }

        return false;
    }
}