Text facing towards the camera

I need to create text in scene which is facing all time towards camera.

I suppose that the appropriate way is to create new texture with required text and put it onto billboarded quad.



I don’t know, what text will i need in the future. Therefore I need to draw it just in time and I don’t need to save it for later use.

Is there any (standard) way how to create own com.jme3.texture.Image? Which would be the parameter of Texture2D constructor?

If it’s just text then why not use BitmapText with a BillboardControl?

I missed this possibility. It seems to be really nice.

Thanks :slight_smile:

BitmapText contains setSize(float size) method.

What is the unit in which is the text size measured?

If I set size 300 and space between two texts is around 100(world -scene units) (texts are situated one above another), It looks like there is no space between them and both texts are almost fully visible without overlapping.

I think it sets the vertical height of the text… including the whitespace above and below the letters. Sort of scales the font.



So, yeah, I’d expect text sized to 300 to overlap if they were only 100 apart.

Probably the line height is defined higher then the letters height. That’s all.



But I have another problem. I want to draw text with its background to be transparent. But there are black rectangles around each letter. Rectangles overlap terrain mesh behind them but don’t overlap line mesh (mesh used to draw trajectory) which is behind them too but it is in front of the terrain mesh.



I’ve set everything according to http://code.google.com/p/lonedev/wiki/BitmapFont



But there is only one example shown at this page with text on black background. Therefore I don’t know, if there appears this problem too or not.

You may have to put the BitmapText in the Transparent bucket.

1 Like

I had to. Thanks :slight_smile: