Skip to content
Swifter edited this page Nov 25, 2024 · 13 revisions

Setup

A Text class handles creating objects from strings of text.

The constructor takes in a path to a text model which will act as the "font" for the text.

const text = await rm.text('my_model')

Alignment

Before the text is placed, there are certain "anchor" options which determine where the text grows from. You can imagine these as similar to the alignment options in pretty much all text editors.

S168I36U7EHc2Q10l0lyaw

  • horizontalAnchor - Determines where the text is anchored horizontally (can be "Left", "Center", and "Right").
  • verticalAnchor - Determines where the text is anchored vertically (can be "Top", "Center" and "Bottom").
text.horizontalAnchor = 'Center'
text.verticalAnchor = 'Bottom'

Positioning

A few options are available to transform the text. You can imagine it as effecting all of the text uniformly, similarly to a parent track.

  • position - Changes the center position of the text.
  • rotation - Rotates text around it's center.
  • scale - Scales the text from it's center.
text.position = [0, 0, 10]
text.rotation = [30, 0, 0]
text.scale = [0.5, 0.5, 0.5]

Spacing

There also some options to change the spacing of the text. Letters are considered mono-spaced, meaning that each character is the same width.

  • letterSpacing - determines the distance between individual letters.
  • wordSpacing - determines the width of spaces, which is the only exception to the mono-spaced format.
text.letterSpacing = 0.8
text.wordSpacing = 0.8

Placing Text As Objects

Make sure all alignment, positioning, and spacing settings are set before creating objects out of the text.

To Objects

You can use the toObjects function on it to create an array of read only model objects based on an input string.

const helloWorldText = text.toObjects('Hello World!')

You can use these objects in whatever way you please, such as plugging them in as the model input for a model scene.

const text = await rm.text('my_model')
const helloWorldText = text.toObjects('Hello World!')

// TODO: update this!!
const scene = rm.modelScene.static(helloWorldText)
scene.instantiate()

To Walls

You can also use the toWalls function on Text to automatically plug the result of toObjects into model to wall.

const text = await rm.text('my_model')
text.toWalls(map, 'Hello World!', 0, 20)

It uses the same parameters as modelToWall except the input model is replaced with the text you want to turn into walls.

Text Model

A text model basically composes of models for every single character you might want to use.

image

For all of the objects composing a character, they should all share a material with a name which matches the character you want to use.

  • Tip: If you have a selection of the objects composing your character and want them all to have a shared material, create a material on the active element, and then Ctrl + L -> Link Materials

image

You should then use ReMapper Blender Exporter to turn this into a .rmmodel file.

Here is a download to an example of a working model.

Clone this wiki locally