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…
doest that seem like its the correct way to do path finding?
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?
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.
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
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.