Mugen87/yuka

Expection in FollowPathBehavior

Closed this issue · 4 comments

All,

I have a blender exported navigation mesh I am running a modified yuka navigation example on. Basically I query for a random region and have the Girl (from Goal) find a path to it. This map has closed doors, so the navigation mesh has multiple 'portals??'. I have hit random regions, in a different portal, that don't have a path from Girl to it. This generates the following exception.

Exception has occurred: TypeError: Cannot read property 'squaredDistanceTo' of undefined at FollowPathBehavior.calculate (http://localhost:8000/yuka/examples/navigation/navmesh/build/yuka.module.js:4525:36) at SteeringManager._calculateByOrder (http://localhost:8000/yuka/examples/navigation/navmesh/build/yuka.module.js:6833:14) at SteeringManager.calculate (http://localhost:8000/yuka/examples/navigation/navmesh/build/yuka.module.js:6772:8) at Girl.update (http://localhost:8000/yuka/examples/navigation/navmesh/build/yuka.module.js:7218:17) at Girl.update (http://localhost:8000/yuka/examples/navigation/navmesh//Girl.js:65:9) at EntityManager.updateEntity (http://localhost:8000/yuka/examples/navigation/navmesh//build/yuka.module.js:7909:11) at EntityManager.update (http://localhost:8000/yuka/examples/navigation/navmesh//build/yuka.module.js:7859:9) at animate (http://localhost:8000/yuka/examples/navigation/navmesh//index.html:350:18)

Do you mind sharing your application as a GitHub repo?

I'm afraid without debugging the issue it will hard to provide useable feedback.

Researching for more details, will post soon.

Well uncertain how to handle this. other than catching the exception in my code. Stepping in the yuka code it dies in "calculate" getting nodes with valid 'source' and 'target' ids. The acquired 'targetNode' ends up undefined, I guess because 'graph' does not contain the regions of separate portal spaces. Randomly landing on a region, occasionally lands outside of the 'graph' regions. I will push something to github in a day or so.

const sourceNode = graph.getNode( source );
const targetNode = graph.getNode( target );
return sourceNode.position.distanceTo( targetNode.position );

I will push something to github in a day or so.

Feel free to reopen the issue when the test application/live example is ready.