Navmesh generation with weights

Dear everybody,
I am writing my thesis project and am to extend software based on JME3.
I have a scene and can generate a Navmesh for that scene.
What I would like to do is weigh that Navmesh.
That in itself shouldn’t be a problem.
What is a problem though is finding the code where the navmesh generation is implemented.
I am certain it happens inside critterai, but I cannot find the code for it to save my life.
I can find a java implementation ( GitHub - bkmeneguello/cai-nmgen ),
I can find the code in jme3ai that uses critterai (doc-examples/ at master · jMonkeyEngine/doc-examples · GitHub), but I can’t find the thing itself.

Can someone point me into the right direction, please?



Hi and thanks for your answer!

Yeah, I’ve posted the link to this repo in my post.
The thing is that I am not sure if that’s the actual implementation used in critterAI and therefore, JME3ai.
Then again, “package org.critterai.nmgen”… Well… I guess that’s the one used in JME3ai?
Can anyone confirm this is the implementation used?

As far as I know this is the source from the things I gathered from the forums.

1 Like

thanks to @mitm im using Recast4J GitHub - ppiastucki/recast4j: Java Port of Recast & Detour navigation mesh toolset

that is great and allow navmesh tile building. very good lib.

im not sure what you mean by weights, but you could search if there is something like this.

but for easy game usage JME version might be faster/easier to use. links post above.

1 Like

Would you help me with this?
I need to pass a vector3f point and if it is not traversable then returns the nearest position to that point…

you mean me? im not using JME ai. but looking at topic

    • Get the nearest cell to the supplied position
    • and place the returned position in that cell.

this mean you just provide location and it auto search nearest cell and if its in cell, then position inside cell, if not, then closest location to nearby cell.

so i think it should work like you need, it dont?

1 Like

maybe, I will test it…
and does it compute a path to the given point to check is it traversable?

no, like in recast, nearest point mean nearest point, you can calculate straight line from A to B only.

pathfinding can find path only on traversable navmesh.

if point you provide into method is on navmesh i assume this method is only to get position on it, not to calculate path, you probably need find other method.

i can only look at
and at files of jme AI. i only see mthods like computePath, onMove, getPath, goToNextWaypoint methods that you need to calculate pathfinding.

1 Like

Have you tried using warp?

Otherwise try one of the methods here.

In recast, you set Area Types and Ability Flags and then use path filters. Much better approach. Significantly harder learning curve though.

1 Like

When using jme3AI I would think since its such a narrow use library maybe when you build the navmesh you should only pass in traversable geometry.

Mark your geometry with materials or some other method that will allow you to grab only those traversable geometry.

Use the slope, height, radius other settings to refine those areas.

With recast, you have Area Types and Ability flags where you set an area by type like ground, water, road, etc and then you use ability flags on those polygons like walk, swim, jump, disabled etc and then use a filter tailored to the character which says if they can walk, swim, or jump so the filter will not return any polygons that the character cannot traverse.