Last active
August 21, 2023 17:59
-
-
Save DataGreed/df0c008be1f9269d5160af413e939843 to your computer and use it in GitHub Desktop.
Checks that NavMeshAgent reached destination or gave up trying
Thanks, haven't done extensive testing yet but works well so far!
Thanks.
You guys are awesome! Thanks for the code.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
public static bool ReachedDestinationOrGaveUp(this NavMeshAgent navMeshAgent) { if (!navMeshAgent.pathPending) { if (navMeshAgent.remainingDistance <= navMeshAgent.stoppingDistance) { if (!navMeshAgent.hasPath || navMeshAgent.velocity.sqrMagnitude == 0f) { return true; } } } return false; }
Will allow you to extend this method directly to the navMeshAgent.