NavMeshPathfinder.computePath tends to take a very aerial approach

Hi Guys
I wanted get the ai characters in my game moving, i decided to use
com.jme.gde.nmgen.NavMeshGenerator to create a dynamic mesh from my terrain + static structures

then I use

[java]
pathFinder = new NavMeshPathfinder(new NavMesh(g.optimize(terrain2mesh)));
pathFinder.computePath(contactPoint, debugInfo);
[/java]

To find the path. so…

  1. doest that seem like its the correct way to do path finding?
  2. The path it finds tends to involve a gigantic leap. and a nice path to the destination. Can anyone point me in the right direction to find out why its doing that?

many thanks

Whats a gigantic leap? If theres a huge plain area then theres not much to say about the path along that area and it will comprise of only one point.

I have a terrain and generally the terrain has an altitude -30. I click around to generate few paths. and print all the waypoints in the path.
not always but on frequent occations the waypoints will be.

for example

[10, -33, -180] -> [12, 33, -160] -> … -> [16, 36, -140] -> [16, -30, -120] -> … [10, -30, -20]

So the waypoint altitude goes from -33 to +33 and then back to ground level. Which results in the character doing a massive jump at the start of the jouirney. Im using a terrain created from a hight map. so the terrain is not even but generally arounf -33 +/- 5

Im pretty sure im not using the path finder correctly. But thought id fire this question to the forum just incase there was something obvious someone can see

thanks

it sounds like you could be having a bug similiar to my issue : http://hub.jmonkeyengine.org/forum/topic/creating-a-navmesh-with-ladders/ (my last post has the solution i use to fix it)

what happens is at the start and end points for some reason y = 0 is hardcoded on NavMeshPathFinder. so if the start or goal cells are above (in the y axis) another cell. the navmesh pathfinder will instead use the lower cell.

if your navmesh does not have cells on top of eachother in the y axis i dont think this is your issue then though. (in my particular case i had a house with 2 floors)

another thing to be weary of is that the navmesh pathfinder “optimizes” the path to try and make it more straightened out. ive experienced issues with it in some scenarios, you might want to try just commenting that part out and see if it still happens.