So I am trying to load a 3D object (Spatial) thru a nifty button
[java] public void load(){
Spatial teapot = assetManager.loadModel(“Models/Teapot/Teapot.obj”);
Material mat_default = new Material( assetManager, “Common/MatDefs/Misc/ShowNormals.j3md”);
teapot.setMaterial(mat_default);
rootNode.attachChild(teapot);
}[/java]
the xml is correct I know this because if I remove the loading part and just put a println() in there it works
whenever I mention the rootNode or the guiNode it stops and nothing else in the function will execute (in short the model wont load)
Oh wait fixed it my self after playing around with the code (amazing what happens when you do that)
the soloution is this [java]
ScreenController f = this;
nifty.fromXml(“Interface/Layouts/Main.xml”, “start”, f); [/java]
still not sure what it did but it works now
That’s because, Nifty created its own instance of the controller class, because one wasn’t given to it