Hello,
i try to generate a motion path from the navmesh path finder
but it always returns 4 way points ---- the two first are the start point of the spatial andthe two last are the target
even with 2 or 3 adjacent coplanar triangles, i get the same issue
here is a screenshot where the mesh is the same as the navmesh (ongoing test)
(one addtional fact is that the navmesh is not centered at location 0,0,0, but offset to a prop that is placed on the map
but so far, the random points (cyan) are located on the navmesh and the only problem is the generated path beein a straight line
instead of following the curve
if it was an issue with the slope of the mesh, then the path finder would not return any path at all (i guess) )
[java]
Vector3f startPoint = spatial.getLocalTranslation();
navMeshPathFinder.pathfinder.setPosition(startPoint);
navMeshPathFinder.pathfinder.setEntityRadius(1f);
//------------- random point on triangle
int randomCell=FastMath.nextRandomInt(0, navMeshPathFinder.navMesh.getNumCells()-1);
Cell cell=navMeshPathFinder.navMesh.getCell(randomCell);
float r1=FastMath.nextRandomFloat();
float r2=FastMath.nextRandomFloat();
float sr1=FastMath.sqrt(r1);
Vector3f target = //navMesh.getCell(randomCell).getRandomPoint();
cell.getTriangle()[0].mult(1-sr1).add(
cell.getTriangle()[1].mult(sr1*(1-r2))
).add(
cell.getTriangle()[2].mult(FastMath.sqrt(r1*r2))
);
navMeshPathFinder.navMesh.snapPointToCell(cell, target);
target.addLocal(facility.getNode().getLocalTranslation());
if(debug)
{
Geometry triangle1=Tools.CreateSphereNode(target,"", 0.1f, ColorRGBA.Cyan,main.getAssetManager());
main.getSceneNode().attachChild(triangle1);
}
//---------------------------------------------- calc navmesh path
Path path=null;
DebugInfo debugInfos = new DebugInfo();
if(navMeshPathFinder.pathfinder.computePath(target,debugInfos))
path = navMeshPathFinder.pathfinder.getPath();
return path;
[/java]
what do i do wrong ? is this a bug ?
thx
[edit : after verification, the debugInfos is not initiallized, all fields are null ???
is the navmesh code at its final stable version ?
i see a warp and onMove entries, it is really confusing
is there any test case/example on how to use the navmesh code ?]