guiNode not detaching its children [Solved]

Hi all. I am not sure why but when guiNode.detachAllChildren() is called the fps rate and all those stuff still remains. I checked with one of my previous project which it removed successfully but to my surprise it does not remove it. Can any one check to see if it is a bug or something is wrong in my end. Thank you.



K Out!

Maybe what you want detached (which is the real question here) is on a different node than guiNode.

guiNode is not for stats view(even if it could be, you should remove control for it). and guiNode is empty on start for your purpose



https://wiki.jmonkeyengine.org/legacy/doku.php/jme3:advanced:statsview



so you propably want to do:

[java]setDisplayFps(false); // to hide the FPS

setDisplayStatView(false); // to hide the statistics [/java]

ahhh yes. oxplay2 is right, thanks. I had to set those two to false. Sometimes simple stuff just gets forgotten. Thank you again.

you write your first post ok, I just do not read “is called the fps rate” before, sorry.



btw: glad to help.

That’s exactly what I meant above but wanted you to realize it without spoonfeeding you. :stuck_out_tongue:

The stats app state is initialized after simpleInit because it was moved to an appstate. If you don’t want stats then remove the app state… or have a constructor in your SimpleApplication subclass that simply calls super() without the stats app state.

so you want to remove GUI/HUD elements?

don’t know, it should work. but i usually use “removeFromParent”.



could you make a testcase?

[java]

@Override

public void simpleInitApp() {

flyCam.setDragToRotate(true);

flyCam.setMoveSpeed(30f);

guiNode.detachAllChildren();

loadMainMenu();

}

[/java]



This is the only place where I used the guiNode to detach all the children. But it does not detach them.

If I use “guiNode.setCullHint(CullHint.Never);” to temporary hide the gui (e.g. a cut scene) it does not work as expected, is there a better way to hide it? should i detach it from its parent and attach it later on to the guiViewPort again?

http://hub.jmonkeyengine.org/javadoc/com/jme3/scene/Spatial.CullHint.html#Never