Playmaker Forum
PlayMaker Help & Tips => PlayMaker Help => Topic started by: Athin on September 23, 2018, 06:58:21 AM
-
Hey guys
I've been having this issue when using this action in Playmaker. I'll set the Agent Destination and under will have the Get Agent Remaining Distance. Problem is that Remaining Distance always returns 0 firing off my finish pathing event right away.
I did some research and it looks like it has something to do with the path still calculating when you do the check causing it to think the distance is 0. I've seen a few people say they fix it but I can't seem to find an action in the ecosystem with the fix and I'm no coder so can't edit it myself. I've made a simple workaround having a Wait action in there but this isn't ideal.
Is anyone able to help me locate this fix action or guide me to the right spot on how to fix it.
Thanks!
-
Hi.
Can you give a link to the post that said that he fixed it?
-
Hi, the easiest solution to this, is to set the distance variable to 10000 in the step before. This should fix the problem.
Also, if the distance is too far from the destination, the default method does not return the correct distance. This is a bug within unity itself. Therefore, I made a second action that calculates the distance properly, called : calculateAgentDistanceByCorners.cs
It can be found here on my github: https://github.com/dumbgamedev/general-playmaker/tree/master/navmesh%20agent
-
Oh, you can also use the path debug action I made, to make sure the agent can reach the destination.