Jme doesn't recognize NaveMesh and PathFinder

Hello sir, sorry for the noob question. I have successfully installed AI plugin in my jme SDK. Now when i am working with AI code I wonder that jme is not recognizing “NavMesh” and “PathFinder” in the code. However it recognizes “Mesh” in the code but again it doesn’t recognize “getGeometry” method. I also tried to create manually navMesh in sceneExlorer but no success. Below are the img of code in my SDK.

Please help me how to solve this.

Go to the project settings and add the AI library in the “Libraries” tab using the “Add Library…” button.

1 Like

Thank you very much normen. It got fixed but still it doesn’t recognize “getGemometry” method. how can i fix this. I tried to cast my sceneModel to geometry but it gave error that node can’t cast to geometry.

Yes, you cannot cast Node to Geometry because it isn’t a geometry, most probably you want to pass one of the child geometries, specifically the navigation mesh geometry.

https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:scenegraph_for_dummies

Sorry norman I didn’t get what you mean. I tried all tweaks in my code but it is not recognizing “getGeometry” method. The link you have shared that I already had gone through during tutorials learning. The similar issue I found in this link http://hub.jmonkeyengine.org/forum/topic/what-is-mylevel-in-navmesh-example-code/ but still couldn’t solve it. It will be really helpful for me if you can please modify for me this line “Mesh mesh = sceneModel.getGeometry(“NavMesh”).getMesh();”

OR

You can elaborate little bit more so that I can do myself. Thanks for your help norman

That is pseudo code… Use getChild and a cast to Geometry, something like this:
Geometry navGeom = (Geometry)node.getChild(“NavMesh”);

Thanks for you help normen. you are really great. i modified my code like this. I don’t know it will work as expected but atleast it is not giving any error and my application also running.

Geometry navGeom = (Geometry)rootNode.getChild(“NavMesh”);
Mesh mesh = navGeom.getMesh();
NavMesh navMesh = new NavMesh(mesh);
NavMeshPathfinder navi = new NavMeshPathfinder(navMesh);
navi.setPosition(model.model_player.getWorldTranslation());