NavMesh ( How to generate a mesh by directly applying the matrix transformation?)

Hello,

First of all sorry for my bad English.

I use the library JM3 Ai Library for the use of NavMesh in the search path. This works well with the terrain. This also works well with a variety of Mesh. To do this, I get the Mesh Geometry object of the object :".

 Node n = (Node) scene;
 Geometry geom = (Geometry) n.getChild("meshPath");
 Mesh mesh = geom.getMesh();
 NavMesh navMesh = new NavMesh(mesh);

The trouble is that no transformation is applied to the mesh, so when I create NavMesh object, the search path does not match my geometry. Moving the agent does not give a good result.

Is there a way to generate a new mesh with the transformations applied ?

Thank you in advance for your answers.

Yes, that happed for me too. You need to apply transform directly to your mesh.
In Blender to do that select your mesh In Object mode, then Control-A - 'Apply Location/Scale/Rotation . Now if you switch to Edit mode you can see the mesh matches with your geometry.

Or you maybe can do it by applying transformation matrix to mesh vertex buffer in JME .
I have not tested this myself. for more info see
https://jmonkeyengine.github.io/wiki/jme3/advanced/custom_meshes.html#toolbar

Thank you for your reply. Indeed, I thought to apply the transformations from the program Blender but if unfortunately I modify the scale of an object in the editor of JMonkeyEngine, everything is to start again in the program Blender.

I think I will rather transform the mesh by applying the transformation matrix in the code. I will recreate the Mesh by applying for each Vertices the transformation matrix. I just thought that an existing method could be applied directly to the Mesh object.

Thank you

1 Like