Skip to content
Alessandro Febretti edited this page Sep 28, 2013 · 8 revisions

[[module cyclops | Python-Reference#module-cyclops]] extends [[Entity]]

last revision: v4.0.2 - 12 Jun 2013

The Text3D entity is used to place text in a 3D scene.

Methods

Method(s) Description
static create(string fontName, float size, string text) Creates a new Text3D object using the specified font, font size and text
setFont(string fontName) Sets the text font name. The font name must point to a font file (.ttf extension supported)
setFontSize(float size) The size of the font characters. The value is in world units, unless setFixedSize(True) has been called on this object.
setFontResolution(int size) the font resolution in texels-per meter
setFixedSize(bool fixed) When set to true, the text size will be in pixels and not in world units. The text size will not change with distance.
setText(string text) Sets the text displayed by this entity
setColor(Color color) Sets the text color

Text Positioning

Text3D always get placed using the bottom right corner of the first line of text. Other offsets have to be applied manually. Try using the Text3D getBoundCenter (or getBoundMinimum for the top left corner) to offset your object placement. If you need more control over text layout consider using the omegatoolkit widget library with 3D containers.

Example

	t = Text3D.create('fonts/arial.ttf', 1, "Hello World!")
	t.setPosition(Vector3(-0.1, 2, -4)
	t.setFontResolution(120)
	t.setColor(Color('red'))
Clone this wiki locally