🆒 TextRender
A Text Render class is useful for spawning Texts in 3D world, you can even attach it to other entities.
info
Utilisation
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.
Constructor Parameters
Type | Nom | Default |
---|---|---|
Vector | location | Vector(0, 0, 0) |
Rotator | rotation | Rotator(0, 0, 0) |
string | text | |
Vector | scale | Vector(1, 1, 1) |
Color | color | Color(1, 1, 1, 1) |
FontType | font_type | FontType.Roboto |
TextRenderAlignCamera | align_camera | TextRenderAlignCamera.Unaligned |
Functions
Inherited Actor Functions
Returns | Name | Description | |
---|---|---|---|
AddImpulse | Applies a Force in world space to this Actor | ||
AttachTo | Attaches this Actor to another Actor | ||
Destroy | Destroys this Actor | ||
Detach | Detaches this Actor if attached | ||
SetCollision | Sets this Actor's collision type | ||
SetForce | Adds a permanent force to this Actor | ||
SetGravityEnabled | Sets whether gravity is enabled on this Actor | ||
![]() | SetVisibility | Sets the Actor visibility | |
SetHighlightEnabled | Sets whether the highlight is enabled on this Actor, and which highlight index to use | ||
SetOutlineEnabled | Sets whether the outline is enabled on this Actor, and which outline index to use | ||
SetLifeSpan | Sets the time (in seconds) before this Actor is destroyed | ||
SetLocation | Sets this Actor's location in the game world | ||
SetNetworkAuthority | Sets the Player this Actor will have its physics calculated on Network Authority | ||
SetRelativeLocation | Sets this Actor's relative location in local space | ||
SetRelativeRotation | Sets this Actor's relative rotation in local space | ||
SetRotation | Sets this Actor's rotation in the game world | ||
SetScale | Sets this Actor's scale | ||
![]() | SetValue | Sets a value in this Actor, which can be accessed by any package | |
TranslateTo | Smoothly moves this Actor to the specified location | ||
RotateTo | Smoothly rotates this Actor to the specified angle | ||
boolean | HasNetworkAuthority | Gets if the LocalPlayer is currently the Network Authority of this Actor | |
boolean | HasAuthority | Gets if this Actor was spawned by the client side | |
![]() | boolean | IsBeingDestroyed | Gets if this Actor is being destroyed |
![]() | boolean | IsGravityEnabled | Gets whether gravity is enabled on this Actor |
![]() | boolean | IsVisible | Gets whether this actor is Visible or not |
![]() | boolean | IsInWater | Gets if this Actor is in water |
![]() | boolean | IsNetworkDistributed | Gets if this Actor is currently Network Distributed |
![]() | boolean | IsValid | Returns if this Actor is valid (i.e. not destroyed) |
![]() | table | GetAttachedEntities | Gets all Actors attached to this Actor |
![]() | any | GetAttachedTo | Gets the Actor this Actor is attached to |
table | GetBounds | Gets this Actor's bounds | |
![]() | number | GetCollision | Gets this Actor's collision type |
![]() | number | GetID | Gets the universal network ID of this Actor |
![]() | Vector | GetLocation | Gets this Actor's location in the game world |
![]() | Rotator | GetRotation | Gets this Actor's angle in the game world |
![]() | Vector | GetForce | Gets this Actor's scale |
![]() | Vector | GetScale | Gets this Actor's scale |
![]() | string | GetType | Gets the type of this Actor |
![]() | any | GetValue | Gets a value stored on this Actor at the given key |
![]() | Vector | GetVelocity | Returns this Actor's current velocity |
string | AddActorTag | Adds an Unreal Actor Tag to this Actor | |
string | RemoveActorTag` | Remove an Unreal Actor Tag from this Actor | |
table | GetActorTags | Gets all Unreal Actor Tags from this Actor | |
![]() | function | Subscribe | Subscribes to an Event |
![]() | Unsubscribe | Unsubscribes from an Event |
Inherited Paintable Functions
Returns | Name | Description | |
---|---|---|---|
![]() | SetMaterial | Sets the material at the specified index of this Actor | |
SetMaterialFromWebUI | Sets the material at the specified index of this Actor to a WebUI object | ||
SetMaterialFromSceneCapture | Sets the material at the specified index of this Actor to a SceneCapture object | ||
ResetMaterial | Resets the material from the specified index to the original one | ||
![]() | SetMaterialColorParameter | Sets a Color parameter in this Actor’s material | |
![]() | SetMaterialScalarParameter | Sets a scalar parameter in this Actor’s material | |
![]() | SetMaterialTextureParameter | Sets a texture parameter in this Actor's material to an image on disk | |
![]() | SetMaterialVectorParameter | Sets a Vector parameter in this Actor’s material | |
![]() | SetPhysicalMaterial | Overrides this Actor's Physical Material with a new one |
Valeur retournée | Nom | Description |
---|---|---|
SetColor | Sets the Color | |
SetFont | Sets the Font | |
SetFreeze | Freeze mesh rebuild, to avoid unnecessary mesh rebuilds when setting a few properties together | |
SetGlyphSettings | Sets the Glyph representation settings to generate the 3D Mesh for this text render | |
SetMaxSize | Sets the Max Size of the TextRender, optionally scaling it proportionally | |
SetText | Sets the Text | |
SetTextSettings | Sets 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)
Type | Parameter | Description |
---|---|---|
Color | color |
SetFont
Sets the Font
my_text_render:SetFont(:font_type)
Type | Parameter | Description |
---|---|---|
FontType | font_type |
SetFreeze
Freeze mesh rebuild, to avoid unnecessary mesh rebuilds when setting a few properties together
my_text_render:SetFreeze(freeze)
Type | Parameter | Description |
---|---|---|
boolean | freeze |
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)
Type | Parameter | Default Value | Description |
---|---|---|---|
number | extrude | 0 | |
number | level | 0 | |
TextRenderBevelType | bevel_type | TextRenderBevelType.Convex | |
number | bevel_segments | 8 | |
boolean | outline | false |
SetMaxSize
Sets the Max Size of the TextRender, optionally scaling it proportionally
my_text_render:SetMaxSize(max_width, max_height, scale_proportionally)
Type | Parameter | Default Value | Description |
---|---|---|---|
number | max_width | 0 | |
number | max_height | 0 | |
boolean | boolean | true |
SetText
Sets the Text
my_text_render:SetText(text)
Type | Parameter | Description |
---|---|---|
string | text |
SetTextSettings
Sets the Text & Font settings for this text render
my_text_render:SetTextSettings(kerning, line_spacing, word_spacing, horizontal_alignment, vertical_alignment)
Type | Parameter | Default Value | Description |
---|---|---|---|
number | kerning | 0 | |
number | line_spacing | 0 | |
number | word_spacing | 0 | |
TextRenderHorizontalAlignment | horizontal_alignment | TextRenderHorizontalAlignment.Center | |
TextRenderVerticalAlignment | vertical_alignment | TextRenderVerticalAlignment.Center |
Events
Inherited Actor Events
Name | Description | |
---|---|---|
Destroy | Triggered when an Actor is destroyed | |
Spawn | Triggered when an Actor is spawned/created | |
ValueChange | Triggered when an Actor has a value changed with :SetValue() |