A problem with text in node in guiNode


Hi i tri to add a BitmapText to a Node with a geom ,to a GuiNode .
The proble is , how ever i locate text i cant see it .

I tried to give it locations in a range of +100 to -100 Z and nothing worked, what am i doing wrong

this.node =(Node) menu.getVillage().
  loadModel("Models/Menu/Tasti/UniversalBotton/UniversalBotton.j3o") ;
    BitmapFont myFont = menu.getVillage().getExe().getMyAssetManager().loadFont("Interface/Fonts/Default.fnt");
    this.text = new BitmapText(myFont, false);
        this.text.setText("Village Managment");
    this.text.setLocalTranslation(0, 0, -1);


Coords are from the bottom left - try using something like (200, 30, 0). (200 or so gets you to the right of the FPS stats stuff JME can render for you.)


But i do see geometry inside node, i just dont see text in same node, or once you add a node to guiNode ,it gets same coords as guiNode inside ?


Not 100% clear on what you’re looking to do, but that setSize() looks suspicious. That value is going to be way too small.


i give the following scale to myNode that i add to guiNode

 node.setLocalScale(settings.getWidth() / 8,
    settings.getHeight() / 4,    0.5f);

next i make a BitmapText myText, and add it to myNode the rest is in code up here :slight_smile:
i see geometry in myNode , but cant see myText



2 / 17 in Java integer math == 0

That’s definitely a problem…


i’ve tried setSize(10) :frowning: not working :frowning: ,i cant get whats wrong :frowning:


Show us the code where you position the node. Show us the code where you add node to the guiNode.

Else here is my answer:
“swe” Notice that it’s only part of the answer because we’ve only seen part of the problem.

Or, I can say:
placing text in the guiNode of course works fine. See any of 100 apps that seem to do it without issue.

   public void eKeyInteraction(NoblesOriginsExe exe, MenuHolder menuHolder){
    FeudalVillageLordsHouseMenu menu= new FeudalVillageLordsHouseMenu(
            getVirtualFeudalDesertVillageLordsHome().getVirtualFeudalDesertVillage(), menuHolder);


   public void createAndLocateKeys(ArrayList al){
    lawMenuKey= new FVLHTantumLawMenuKey(this);
            village.getExe().getAppSettings().getHeight()/8*5, -1);
            .getAppSettings().getWidth()/10, village.getExe().getAppSettings().getHeight()/8, 1);
    createFVMenuKey= new FVLHCreateFVMenuKey(this);
            village.getExe().getAppSettings().getHeight()/8*3, -1);
            .getAppSettings().getWidth()/10, village.getExe().getAppSettings().getHeight()/8, -1);


   public FVLHCreateFVMenuKey(FeudalVillageLordsHouseMenu menu) {
    this.menu = menu;
    this.node =(Node) menu.getVillage().
            getExe().getMyAssetManager().loadModel("Models/Menu/Tasti/UniversalBotton/UniversalBotton.j3o") ;
    Light light= new AmbientLight(ColorRGBA.White);
    node.setLocalTranslation(menu.getVillage().getExe().getAppSettings().getWidth() / 2,
    menu.getVillage().getExe().getAppSettings().getHeight() / 2, 0);//middle of screen
    node.setLocalScale(menu.getVillage().getExe().getAppSettings().getWidth() / 8,
    menu.getVillage().getExe().getAppSettings().getHeight() / 4,    0.5f);
    BitmapFont myFont = 
    text= new BitmapText(myFont,false);
    text.setText("Village Managment");  



This code is all over the place. It’s very weird to set the local scale of the node but then use the first child as something to set the position. All of this weird indirection is making your problem much harder to find, makes your code super-fragile, and is confusing in the best of cases.

I suspect if you simplify the problem you will find your issue.

Edit: Also, I still don’t see where node is added to the guiNode. I see no interaction with the guiNode at all. Is this really being added to the guiNode or to the main scene? (Adding models to the guiNode is already suspicious since the zScale is always 0 in the guiNode.)


keysNode is added to guiNode ( tested and working) .
Problem is myNode is getting added , and i see it , and its where should be , but … its missing BitmapText that i’m adding to it …


When in doubt, print the world bounds to system out. Work back from there.

Your problems are all self-made but that will be the easiest way to sort them out.

Else could it be that your text is inside your model?


well i try to locate it in front of my model


I ve made a test ,seems every thing works fine when i just start the game , but after it runs , same thing does not works . Code i made works only at

public void simpleInitApp() { 

, but then it just stops working and BitmapText is not getting showed (invisible), its attacked and has text , same location as when visible at start , but its not vissible if added just after simpleInitApp()