Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: Gua on September 10, 2014, 10:25:41 AM
-
I've tried to set agent destination using "set agent destination" and "Set agent destination as game object" in both cases agent does move to destination, but when I try to calculate remaining distance using "Get Agent Remaining Distance" in both cases the result is infinity. What am I doing wrong?
p.s. Only when there's less than 10 units to the target, it starts to show numbers.
-
Hi,
are you sure the destination AND the agent are on the navmesh?
Bye,
Jean
-
I am actually running into this same issue. It seems to occur when there is more than two corners for the nav mesh agent to navigate around. My agent and destination are on the same plane. This seems to be unity issue, rather than a playmaker one in specific, but very annoying none-the-less. I am still looking for a solution.
-
I would like to note, once the agent starts getting close to the destination, the calculation does begin, but not until it rounds that first corner.
So this is a unity issue. It has been around since 2015 at least, as reported here: http://unitytipsandtricks.blogspot.com/2015/10/taming-unitys-navigation-system.html
See "Assumption #2", NavMeshAgent.remainingDistance will always tell us how far we have to go.
(Hint, it doesnt always work). They recommend calculating the distance between corners (path points), instead.
-
Ive created an action to solve this problem. See here for the info and download: http://hutonggames.com/playmakerforum/index.php?topic=15057.0