How to add Spatials to HUD?

The tutorial mentioned briefly that spatials can be added to the hud, but there is no example of this and I have so far been unsuccessful. I also tried scaling the object a bit up as I believe the unit is pixels while my object is probably on a smaller unit scale. I have tried both positive and negative z values with no particular luck. Normal Picture elements show up fine though.



[java]Spatial coin = assetManager.loadModel("Models/coin.mesh.xml");

coin.setLocalTranslation(settings.getWidth()-(h/2), h/2, -1f);

coin.scale(100f);

coin.setQueueBucket(Bucket.Gui);

guiNode.attachChild(coin);[/java]

http://www.hub.jmonkeyengine.org/wiki/doku.php/jme3:faq#how_do_i_display_score_health_mini-maps_status_icons

Ok, figured it out. I needed to add a light source so I just added an Ambient light and voila! :slight_smile:



The tutorial mentioned that, but I didnt expect the spatial to be completely culled, but rather turn up black.



Anyway, any idea why objects turn up fairly dark even with an Ambient light set to ColorRGBA.White? I see if I turn the object a bit one side of it shines brightly, but I thought ambient light should give even light across all surfaces of the object?

@johncl said:
Anyway, any idea why objects turn up fairly dark even with an Ambient light set to ColorRGBA.White? I see if I turn the object a bit one side of it shines brightly, but I thought ambient light should give even light across all surfaces of the object?

I had similar problem and in my case it turned out to be an Ambient color set to black for every material in loaded object. I was loading from .obj resource and you can find ambient colors by looking at "Ka" parameters (for every material) in corresponding .mtl file.

Thanks, that might be the case. I dont even set the Ambient color on my imported blender stuff. I will check that and make sure they are in the right color depending on the texture used (I noticed Google Sketchup did this automatically for textured materials).