Text
Text are individual 3D objects, all text objects which share the same font use one draw call per scene.
Visually a text object with scale (1,1,1) appears as 20cm (0.2 world units) tall.
Creating a text object:
const textObject = Text('hi!')
or add a Text object in the UI editor: edit-> + icon ->Text.
Properties
const optionalProps = {
anchorX: 'left | center | right', // default = 'left'
anchorY: 'top | center | bottom', // default = 'center'
lineHeight: 1.1,
letterSpacing: 1.1,
wrap: 0.5, // default = 0 (none)
font: 'yourFontAssetName.tff',
color: new U.Color() | '#fff0f0',
material: someMaterial,
// Allocate geometry for 250 characters
// This is more efficient for dynamic text
preallocate: 250,
}
const text = Text('Hello World', props)
Methods
// update the text
textObject.set('new string value')
// update text color
textObject.setColor('#fff000')
textObject.setColor(new U.Color())