How to get the rootNode in a non-Main class

How can I get the rootNode in a non-Main class so that I can use it to put stuff on the screen? Right now I’ve made a method in my Main class that when you call it, you pass a spatial to it, and it attaches it to the rootNode :


//Attach to RootNode

public void ARN (Spatial model) {




However it’s not doing anything, and I think that it would be much easier to just use the root in the method that I need it.

Why not use the same method as you did with the asstemanager?

Note that when you just use an AppState, you get an initialize() call on the opengl thread where you can properly reference all kinds of stuff from the application, or even get other appStates :open_mouth:

@zzuegg said:
Why not use the same method as you did with the asstemanager?

Well what do you know It worked. Sorry for posting (what I feel to be) meaningless questions where the answers right in front of me. Next time I will try a lot harder to find the answer before coming here and wasting your time.

It might be worth noting and I’m trying not to be harsh or anything… that writing a game in Java would greatly benefit from learning Java a little better. Or at least being prepared to slog through lots of regular Java tutorials.

3D game programming is hard enough on its own… one of the hardest types of programming. Harder still if you are new to a language.

You’re right there, I’ve only been programming in java for a few months, and I’m still learning as I go, but it is getting easier.

@normen said:

Thanks for the great resource normen, I'll definitely be using it quite a bit.
1 Like