Adding spatial to guinode shows nothing!

why i cant see any thing in gui node?
I know 1 unit = 1 pixel in gui and I add a sun light to it …
and model shows correctly in rootNode…

    DirectionalLight sun = new DirectionalLight();
    sun.setDirection((new Vector3f(-0.5f, -0.5f, -0.5f)).normalizeLocal());
    sun.setColor(ColorRGBA.White);
    app.getGuiNode().addLight(sun);

    Spatial ababil = app.getAssetManager().loadModel("Models/ABANIL II/ABANIL II.j3o");
    ababil.setLocalTranslation(500, 500, 0);
    ababil.setLocalScale(1500);

    app.getGuiNode().attachChild(ababil);

All appoints to that the scene is not in the camera range. Try this code:

public void simpleInitApp() {
        // Lighting
        DirectionalLight dl = new DirectionalLight();
        dl.setDirection(Vector3f.UNIT_Z.negate());
        
        guiNode.addLight(dl);
        
        // Material creation
        Material mat = new Material(assetManager, "Common/MatDefs/Light/Lighting.j3md");
        mat.setColor("Diffuse", ColorRGBA.White);
        
        // Mesh Creation
        Box b = new Box(1, 1, 1);
        
        // Geometry creation
        Geometry geom = new Geometry("Box", b);
        geom.scale(500);
        geom.setMaterial(mat);
        geom.setLocalTranslation(500, 500, 0);
        
        // Geometry attach
        guiNode.attachChild(geom);
    }

That sample test should work. If so, try to find out why your scene is not in the screen range. ¿When in rootNode, it is shown in the (0,0,0)?.
Remember that the guiNode translates from the bottom-left corner. So, with (500, 500, 0) you are translating it to 500 pixel to the right and 500 to up.

also note that the gui node coordinates are from 0 to th the screen width on x and 0 to the height of your screen on y (starting from the bottom).
So basically if you have a 1 unit large model, it’s basically a pixel in the gui node.
Scale it a hundred times and you should see it.

well… it seems he already scaled it 1500 times xD .

1 Like

ho didn’t see that part :stuck_out_tongue:

nothing changed…
i cant see anything.(colored cube shows correct but spatial doesnt)

help me …