AI plugin now with NavMesh pathfinding

You can cast the spatial to geometry:

Geometry geom = (Geometry)worldRootNode.getChild("NavMesh"); Mesh mesh= geom.getMesh();

@normen said: You can cast the spatial to geometry: [code]Geometry geom = (Geometry)worldRootNode.getChild("NavMesh"); Mesh mesh= geom.getMesh();[/code]


I did now. I was reading code from RigidBodyControl and i saw a cast from Spatial to Geometry to use getMesh, i so constrained.

thank you for help.

Wasn’t sure where to post this, but I think this is the best spot.

So I downloaded the navmesh pathfinding code from

Then I ran into trouble and in the end I found the problem. When I load my scene, I scale and after scaling I get the init the navmesh, I noticed that the navmesh isn’t being completely scaled. It seems the info of the cells doesn’t scale, like Vector3f center, now I fixed this by just scaling any info I gave navmesh and also then scaled the other direction every info I got out of it.

I just wanted to let you know, incase someone else runs into this problem or if someone is still working on it.

1 Like

How can a nav mesh be generated using code?. I would like to load some “.scene” and generate it nav mesh on runtime.

I think I have it (thanks to MonkeyZone):

public Geometry createNavMesh(Node node) {
        Mesh mesh = new Mesh();
        NavMesh navMesh = new NavMesh();
        NavMeshGenerator generator = new NavMeshGenerator();
        GeometryBatchFactory.mergeGeometries(findGeometries(node, new LinkedList<Geometry>()), mesh);
        Mesh optiMesh = generator.optimize(mesh);


        Geometry navGeom = new Geometry("NavMesh");
        Material green = new Material(assetManager, "Common/MatDefs/Misc/Unshaded.j3md");
        green.setColor("Color", ColorRGBA.Green);
        return navGeom;
1 Like

I seem to have fixed a very common exception I was getting with NavMeshPathfinder, and apparently others, here:


I’me very interested by this development, and curious to see the steering behaviors.

I’ve implemented myself a A* (unused) , steering behaviors, finite state machine, and flow fields for my RTS game engine project (Watch the videos to see them in action).

Feel free to ask if you think one of these algorithms may help. Note that my code is JME independant (but all java).


Can’t go to the link. Is it still available?

i guess the link changed to this [Project] RTS game engine : OpenRTS is released

Yes thanks, I edited my link.

Already found it a while ago.
Nevertheless, thanks for posting the correct link.
Also I’m one of your project gitHub stars.

THAT is reactivity :smiley: (thx for the start ^^)