How to convert text to mesh in the game engine using python?

I’m looking for a way to attach a script to a text object so that it converts to a mesh in the game engine, while the game is running. I.e. not using bpy but bge. Is this possible?

So it would look something like this in the logic window:
Keyboard “Space” (tap) > python [script that converts text object in scene to mesh]

The reason I’m doing this is because converting it to a mesh provides more options to visually manipulate it (some examples: using the replace actuator to replace other meshes with the new text object, doing some complicated warping animations using armatures, etc).

This would, in theory, make it easier to edit the text in blender in the viewport itself when making the game instead of exporting text as a png, saving the texture externally, applying the texture to a mesh, etc.

i believe that’'s not possible ingame. you should convert it to mesh in the 3dview before starting the game

What Cotaks said, or …

  • trace the Text, and replace it Char by Char with 3D Model Chars.

  • if it’s only for visual FX, code a shader to type on a Texture, which can transformed by the shader (don’t ask me how, but im pretty sure thats doable.)

here is an alternative to what you are trying to do.
texture-font2.blend (1.5 MB)

2 Likes