VFX | Text System

Allows a user to add text to the game that can be used for labels, signs etc

Parameters

Name
Description
Default

font

CSS font name ["ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, 'Noto Sans', sans-serif, 'Apple Color Emoji', 'Segoe UI Emoji', 'Segoe UI Symbol', 'Noto Color Emoji'"]

fontSize

Size of font

20

fontWeight

CSS font-weight

700

offsetTop

Move the text up/down within the texture

0

backgroundColor

CSS color, supports transparency

#11182780

fontColor

CSS color, supports transparency

"white"

fontOutlineColor

CSS color, supports transparency

"black"

fontOutlineWidth

0

margin

Amount of padding around the background border

10

linePadding

Amount of extra vertical padding inbetween lines

4

radius

Radius of rounded background rectangle corners

6

faceCamera

Optionally always angle the text towards the camera

false

scl

By default, child's scale is the width and height of the canvas. It will then also be multiplied by this number

1/150

sizeAttenuation

If false, the text will always appear the same size no matter how far or near the camera is from it. Only valid when faceCamera is true

true

proximity

Maximum distance that the camera can be from the text before it's hidden. -1 for infinity/always visible

-1

transform

defTransform options for obj

metadata

Optional extra data to send to clients

null

"recips" arg

  • recips can either be an array of peers OR the string "all"

  • add null to recips array to send to server host

  • using "all" for recips will also send the vfx to new peers as they connect

Adding Text

After adding text, the text VFX id will be returned.

DEBUG.BB.planet.vfx.serverAdd("all", "text",
{
	font: "'Arial', sans-serif",
	fontSize: 50,
	backgroundColor: "#FF0000FF",
	fontColor: "#00FF01",
	margin: 30,
	linePadding: 10,
	radius: 10,
	faceCamera: true,
	transform:
	{
		pos: DEBUG.BB.planet.player.position,
		rot: new DEBUG.Euler(0, Math.PI, 0)
	}
},

"Oh, you think darkness is your ally.\n But you merely adopted the dark;\n I was born in it"
); // returns text id

Removing Text

Remove all text

DEBUG.BB.planet.vfx.serverRemoveAll()

Remove text by ID

DEBUG.BB.planet.vfx.serverRemove(id);

Last updated