Text Objects in Blender Game Engine - Questions

Hi ALl,

I’m new to BGE, and I’m trying to do a few things with text in BGE 2.6

I am able to change the text of a text object on-the-fly using a simple Python script to change the obj.text attribute. Cool!

BUT - My text object appears with a nice 3D look (extruded and bevelled as per the font settings) in the Blender Render, and Cycles engine. It also looks right when Blender Game is selected as I’m editing and setting up the scene, but when I run the game engine… Voila - nasty looking flat text. Not only is it flat, but it’s very scraggy/aliased.

Is there a way to at least get the scraggy aliased edges to go away?.. and of course, what I really want is for the extrude and bevel settings to stick and look as they do in the camera view as I set it up.

I’m sure they may be limitations, but I find it very difficult to find helpful concise documentation anywhere on how to deal with text as supported in 2.6

Also, are materials now possible for text in BGE in 2.6 - If so… how?

Thanks so much!

Valentin

There is a problem with the text in that:
the zoom is often wrong, leaving it blocky
Only some attributes are supported in game.
Materials have no effect. Colour can be changed by python, I think.

You can convert to mesh if it doesn’t require changing.
you can use text planes.
You can use blf. It is a script that does the same.
You can wait for the next version.

If I remember correctly (it may have changed since 2.5X) but text can have its colour changed via the object colour (not to be confused with the material colour).

Yeah, you can change color with the object color box in the Object panel (the cube, not the material panel, which is a textured circle). Currently, there’s no way to have editable 3D text in the game engine - you have to either use 2D text, or convert the text to a 3D object with Alt+C, if I recall.

Thanks for the replies…

The text I’m planning to use does require changing during game play - so i guess i’m out of luck on that one for the time being. 2D text it is - It didn’t look like it was casting shadows either… but I’ll have to double-check how my lighting was setup. Might be working but I didn’t see it.

sdfgeoff, How do I adjust the “zoom”? I’m not sure in what respect you mean that the zoom is often wrong.

Thanks!

Valentin

You can’t, it’s a bug.
In order to optimise display of the text, it reduces the resolution to match the screens resolution (or at least, that’s the idea)

Can you adjust the kerning on text?

I often do this as a workaround:


def text_resolution(object):
    object.resolution = 3
    scaling = object.localScale[2]
    scaling *= 0.65 #value eyeballed per font used
    object.localScale = (scaling, scaling, scaling)

def fix_fonts():
# change resolution of text objects
    for scene in logic.scenes.values():
        for object in scene.objects:
            if object.__class__ == types.KX_FontObject:
                text_resolution(object)
 
fix_fonts() #call it with an Always sensor

Hi guys,

picking up the tread while trying to use a text object in a heads up display for 2.62, I followed your advice and scaled the text to 1, which was taking most of my camera view on that. Moving the text back along z so get the correct “view” size, together with placing it on x/y afterwards, provided sufficient results.

No scripting, using the text color and being able to change the text on the fly using the Text property.

Try it!

Cheers,

Living