NavMeshPathFinder in jme 3.1

Hi guys…

I was using

for path finfding in my game… I recently switched to using jme3.1
and i had to copy the project and change a few

intersectionPoint.interpolate(wall.getPointB(), wall.getPointA(), distBlend);

to

intersectionPoint.interpolateLocal(wall.getPointB(), wall.getPointA(), distBlend);

To get it to work… However now my game crashes fairly regularly with the following stack trace

"pool-6-thread-1" #34 prio=5 os_prio=31 tid=0x00007f9a2300f000 nid=0x3b0b runnable 
[0x000000018a477000]
java.lang.Thread.State: RUNNABLE
at com.jme3.ai.navmesh.Cell.classifyPathToCell(Cell.java:401)
at com.jme3.ai.navmesh.NavMesh.isInLineOfSight(NavMesh.java:184)
at com.jme3.ai.navmesh.Path.getFurthestVisibleWayPoint(Path.java:176)
at com.jme3.ai.navmesh.Path.getFurthestVisibleWayPoint(Path.java:144)
at com.jme3.ai.navmesh.NavMeshPathfinder.buildNavigationPath(NavMeshPathfinder.java:346)
at com.jme3.ai.navmesh.NavMeshPathfinder.computePath(NavMeshPathfinder.java:126)
at com.jme3.ai.navmesh.NavigationProvider.computePath(NavigationProvider.java:38)
- locked <0x0000000741bb6df8> (a com.jme3.ai.navmesh.NavigationProvider)
at com.jme3.lostVictories.objectives.TravelObjective.planObjective(TravelObjective.java:61)

im not actually 100% sure whats going on here.
Does this mean its in an infinite loop ?
I do call path finding outside the main update loop… As it doesn’t change the scene graph… annoyingly the game doesn’t seem to crash when i debug it… So im finding it very difficult to tell whats happening apart from taking thread dumps once it has crashed

I found that calling jme3-ai outside the main thread is fine as long as there’s no more that one thread doing so.
Are you doing that? I used a Executors.newSingleThreadExecutor() to run my searches.

btw, I did this before 3.1.

1 Like

Ah… I see i do have multiple threads calling it… and thought i would only allow one thread in at one time by putting synchronised on the top level method that does path finding…

ill try you suggestion…
thanks

Btw there is MeFisto94/jme3-artificial-intelligence on github which has that change you did for 3.1, for any one wondering if there is an updated version