playMaker

Author Topic: Calculate Navmesh Agent Path Target Destination by Corners  (Read 7356 times)

tcmeric

  • Beta Group
  • Hero Member
  • *
  • Posts: 768
Calculate Navmesh Agent Path Target Destination by Corners
« on: April 30, 2017, 12:06:51 PM »
Unitys built in NavMeshAgent.remainingDistance can return the result of infinity (instead of the correct distance) when two or more corners (path points) have been calculated. This means the playmaker action "Get Agent Remaining Distance" is not reliable in many cases (as it is using NavMeshAgent.remainingDistance).

An alternative method is calculating the corners (path points) distance instead. An example is given in the unity documentation. I used the documentation to create an action to do so.

https://github.com/dumbgamedev/general-playmaker/blob/master/path/calculateAgentDistanceByCorners.cs

Ive tested it out several times and it returns the same result as the action Get Agent Remaining Distance, except it never returns infinity (good!).

Maybe this action plus the path debug action I posted should be added to the playmaker navmesh package? (Might need name changes/ different category).

autumnboy

  • Junior Playmaker
  • **
  • Posts: 73
Re: Calculate Navmesh Agent Path Target Destination by Corners
« Reply #1 on: October 12, 2017, 01:53:48 AM »
Awesome. Get Agent Remaining Distance was driving me crazy. Thanks for this! :)

jeanfabre

  • Administrator
  • Hero Member
  • *****
  • Posts: 15500
  • Official Playmaker Support
Re: Calculate Navmesh Agent Path Target Destination by Corners
« Reply #2 on: October 12, 2017, 04:04:29 AM »
Hi,

 yes it should be added indeed :)

 Eric, do you feel like adding it to the github rep?

bye,

 Jean

Twood

  • Junior Playmaker
  • **
  • Posts: 76
Re: Calculate Navmesh Agent Path Target Destination by Corners
« Reply #3 on: June 01, 2021, 03:28:51 PM »
Looks like it was never added to ecosystem? Would someone mind adding it?

edit: actually nevermind this also is not working right. I hate unity pathfinding, it's so hard to get into useful shape lol.
« Last Edit: June 01, 2021, 04:04:42 PM by Twood »