Dear everybody,
I use the town.zip scene from the tutorial.
I load the scene into SceneComposer, create a NavMesh with SceneComposer.
That NavMesh shows in the SceneExplorer. Behold:
https://i.imgur.com/acVceIz.png
However, when I try to access the NavMesh in the code, I get a null pointer. So it doesn’t find the mesh.
public void printChildrenNames(Node n){
for (Spatial child : n.getChildren()){
System.out.println(child.getName());
}
}
Node n = (Node) demo;//thats main-scene_node
printChildrenNames(n);
Geometry geom = (Geometry) n.getChild("NavMesh");
System.out.println(geom==null);
line 131-> System.out.println("mygame.Main.initSceneAndPlayer()"+geom.getName());
Mesh m = geom.getMesh();
NavMesh navMesh = new NavMesh(m);
Output of running the code:
Which is obvious, since geom is null.
Geom is null because there is only level as a child of main-scene_node.
But why does the SceneExplorer show the NavMesh node then?
I saved multiple times. I can load the scene and the navmesh is still there.
Can anyone help me, please? I am at a loss.
Best,
j