playMaker

Author Topic: NavMeshAgent: Determine if Set Agent Destination As Game Object is complete?  (Read 3737 times)

k00k

  • Playmaker Newbie
  • *
  • Posts: 3
I'm successfully using "Set Agent Destination As Game Object" from the NavMeshAgent actions to move an object (AI model) to a waypoint (Destination game object).

How can I determine when it reaches that destination so I can trigger FINISHED?

terri

  • Sr. Member
  • ****
  • Posts: 386
    • terrivellmann.tumblr.com
If you use Get Agent Remaining Distance there is an "arrived" event

k00k

  • Playmaker Newbie
  • *
  • Posts: 3
Yes, I found that and I set "Arrived Event" to FINISHED. However, when I hit play, it finishes instantly. So _agent.remainingDistance==0 (this is the condition that this script checks) is happening right away for some reason.

k00k

  • Playmaker Newbie
  • *
  • Posts: 3
I updated the condition that I mentioned and it now works. See my gist: https://gist.github.com/k00k/404ca85b8c56587786327066d003aaec#file-getagentremainingdistance-cs-L75-L76

terri

  • Sr. Member
  • ****
  • Posts: 386
    • terrivellmann.tumblr.com
Cool, I tested it and had the same problem, your solution works well!

Gua

  • Beta Group
  • Sr. Member
  • *
  • Posts: 309
    • Andrii Vintsevych
Link no longer works :(