Skip to main content
Version: latest - a1.7.0 βš–οΈ

πŸ†’ TextRender

A Text Render class is useful for spawning Texts in 3D world, you can even attach it to other entities.

info

🟦🟧 Authority: This class can be spawned on both Client and Server (if you spawn it on client, it won't be synchronized with other players).

⏬ Inheritance: This class inherits from Actor and Paintable.

Usage​

local my_text_render = TextRender(
Vector(-100, 200, 300),
Rotator(),
"My Awesome Text",
Vector(1, 1, 1), -- Scale
Color(1, 0, 0), -- Red Color
FontType.OpenSans,
TextRenderAlignCamera.FaceCamera
)
info

If you desire your TextRender to be visible through walls, replace it’s material with the nanos Default TranslucentDepth one!

SetMaterial("nanos-world::M_NanosTranslucent_Depth").

You can also tweak it’s color and other properties using the Material methods.

Nametagsgetting-started/tutorials-and-examples/name-tags

Constructor Parameters​

TypeNameDefault
VectorlocationVector(0, 0, 0)
RotatorrotationRotator(0, 0, 0)
stringtext
VectorscaleVector(1, 1, 1)
ColorcolorColor(1, 1, 1, 1)
FontTypefont_typeFontType.Roboto
TextRenderAlignCameraalign_cameraTextRenderAlignCamera.Unaligned

Functions​

Inherited Actor Functions
ReturnsNameDescription
AddImpulseApplies a Force in world space to this Actor
AttachToAttaches this Actor to another Actor
DestroyDestroys this Actor
DetachDetaches this Actor if attached
SetCollisionSets this Actor's collision type
SetForceAdds a permanent force to this Actor
SetGravityEnabledSets whether gravity is enabled on this Actor
SetVisibilitySets the Actor visibility
SetHighlightEnabledSets whether the highlight is enabled on this Actor, and which highlight index to use
SetOutlineEnabledSets whether the outline is enabled on this Actor, and which outline index to use
SetLifeSpanSets the time (in seconds) before this Actor is destroyed
SetLocationSets this Actor's location in the game world
SetNetworkAuthoritySets the Player this Actor will have its physics calculated on Network Authority
SetRelativeLocationSets this Actor's relative location in local space
SetRelativeRotationSets this Actor's relative rotation in local space
SetRotationSets this Actor's rotation in the game world
SetScaleSets this Actor's scale
SetValueSets a value in this Actor, which can be accessed by any package
TranslateToSmoothly moves this Actor to the specified location
RotateToSmoothly rotates this Actor to the specified angle
booleanHasNetworkAuthorityGets if the LocalPlayer is currently the Network Authority of this Actor
booleanHasAuthorityGets if this Actor was spawned by the client side
booleanIsBeingDestroyedGets if this Actor is being destroyed
booleanIsGravityEnabledGets whether gravity is enabled on this Actor
booleanIsVisibleGets whether this actor is Visible or not
booleanIsInWaterGets if this Actor is in water
booleanIsNetworkDistributedGets if this Actor is currently Network Distributed
booleanIsValidReturns if this Actor is valid (i.e. not destroyed)
tableGetAttachedEntitiesGets all Actors attached to this Actor
anyGetAttachedToGets the Actor this Actor is attached to
tableGetBoundsGets this Actor's bounds
numberGetCollisionGets this Actor's collision type
numberGetIDGets the universal network ID of this Actor
VectorGetLocationGets this Actor's location in the game world
RotatorGetRotationGets this Actor's angle in the game world
VectorGetForceGets this Actor's scale
VectorGetScaleGets this Actor's scale
stringGetTypeGets the type of this Actor
anyGetValueGets a value stored on this Actor at the given key
VectorGetVelocityReturns this Actor's current velocity
stringAddActorTagAdds an Unreal Actor Tag to this Actor
stringRemoveActorTag`Remove an Unreal Actor Tag from this Actor
tableGetActorTagsGets all Unreal Actor Tags from this Actor
functionSubscribeSubscribes to an Event
UnsubscribeUnsubscribes from an Event
Inherited Paintable Functions
ReturnsNameDescription
SetMaterialSets the material at the specified index of this Actor
SetMaterialFromWebUISets the material at the specified index of this Actor to a WebUI object
SetMaterialFromSceneCaptureSets the material at the specified index of this Actor to a SceneCapture object
ResetMaterialResets the material from the specified index to the original one
SetMaterialColorParameterSets a Color parameter in this Actor’s material
SetMaterialScalarParameterSets a scalar parameter in this Actor’s material
SetMaterialTextureParameterSets a texture parameter in this Actor's material to an image on disk
SetMaterialVectorParameterSets a Vector parameter in this Actor’s material
SetPhysicalMaterialOverrides this Actor's Physical Material with a new one
ReturnsNameBeschreibung
SetColorSets the Color
SetFontSets the Font
SetFreezeFreeze mesh rebuild, to avoid unnecessary mesh rebuilds when setting a few properties together
SetGlyphSettingsSets the Glyph representation settings to generate the 3D Mesh for this text render
SetMaxSizeSets the Max Size of the TextRender, optionally scaling it proportionally
SetTextSets the Text
SetTextSettingsSets the Text & Font settings for this text render

SetColor​

Sets the Color Internally this will call the SetMaterialColorParameter("Tint", color) method

my_text_render:SetColor(color)
TypeParameterBeschreibung
Colorcolor

SetFont​

Sets the Font

my_text_render:SetFont(:font_type)
TypeParameterBeschreibung
FontTypefont_type

SetFreeze​

Freeze mesh rebuild, to avoid unnecessary mesh rebuilds when setting a few properties together

my_text_render:SetFreeze(freeze)
TypeParameterBeschreibung
booleanfreeze

SetGlyphSettings​

Sets the Glyph representation settings to generate the 3D Mesh for this text render

my_text_render:SetGlyphSettings(extrude, bevel, bevel_type, bevel_segments, outline)
TypeParameterDefault ValueBeschreibung
numberextrude0
numberlevel0
TextRenderBevelTypebevel_typeTextRenderBevelType.Convex
numberbevel_segments8
booleanoutlinefalse

SetMaxSize​

Sets the Max Size of the TextRender, optionally scaling it proportionally

my_text_render:SetMaxSize(max_width, max_height, scale_proportionally)
TypeParameterDefault ValueBeschreibung
numbermax_width0
numbermax_height0
booleanbooleantrue

SetText​

Sets the Text

my_text_render:SetText(text)
TypeParameterBeschreibung
stringtext

SetTextSettings​

Sets the Text & Font settings for this text render

my_text_render:SetTextSettings(kerning, line_spacing, word_spacing, horizontal_alignment, vertical_alignment)
TypeParameterDefault ValueBeschreibung
numberkerning0
numberline_spacing0
numberword_spacing0
TextRenderHorizontalAlignmenthorizontal_alignmentTextRenderHorizontalAlignment.Center
TextRenderVerticalAlignmentvertical_alignmentTextRenderVerticalAlignment.Center

Events​

Inherited Actor Events
NameDescription
DestroyTriggered when an Actor is destroyed
SpawnTriggered when an Actor is spawned/created
ValueChangeTriggered when an Actor has a value changed with :SetValue()