WorldVisuals
Client only WorldVisuals is unavailable in a Reflex module’s server.lua.
How objects are processed
Section titled “How objects are processed”CreateLineRenderer() and CreateSurfaceOverlay() create real local render objects in the client scene and return control wrappers. Setters update parameters on the existing renderer; they do not need to be repeated every frame when a value is unchanged.
The server does not know about these objects, and physics or gameplay does not account for them. RemoveObject() removes only the visual object and does not affect an entity or surface near which it was drawn.
Where the result appears
Section titled “Where the result appears”LineRendererdraws a line directly in the 3D world through the specified world-space positions. It is not a HUD element.SurfaceOverlayprojects a colored area onto world geometry inside the specified volume. It does not create a flat screen overlay.- Objects remain in the world until the module calls
WorldVisuals:RemoveObject()or is unloaded. - The API renders objects directly and does not depend on a built-in HUD module. It also does not attach them to a camera or entity automatically—update the position yourself for a moving marker.
Quick example
Section titled “Quick example”local line = WorldVisuals:CreateLineRenderer()
if line ~= nil then line:SetPositions({ Vector3.new(0, 1, 0), Vector3.new(2, 1, 2), Vector3.new(4, 1, 0), }) line:SetColor(Color.new(1, 0.1, 0.8, 1)) line:SetWidth(0.08)
Scheduler:Schedule(5, function() WorldVisuals:RemoveObject(line) end)endWorldVisuals
Section titled “WorldVisuals”Global API for creating visual objects in the world.
CreateLineRenderer
Section titled “CreateLineRenderer”WorldVisuals:CreateLineRenderer(): LineRendererCreates and returns a line object. It can return nil when the module reaches its object limit.
CreateSurfaceOverlay
Section titled “CreateSurfaceOverlay”WorldVisuals:CreateSurfaceOverlay(): SurfaceOverlayCreates an area projected onto world surfaces. It can return nil when the object limit is reached.
RemoveObject
Section titled “RemoveObject”WorldVisuals:RemoveObject(object)Removes a previously created line or area. The call returns nil.
LineRenderer
Section titled “LineRenderer”A polyline made of world-space points.
Properties
Section titled “Properties”| Property | Type | Access | Description |
|---|---|---|---|
PositionCount |
int | get/set |
Number of line points. The maximum is 2048. |
Geometry
Section titled “Geometry”SetPositionCount
Section titled “SetPositionCount”LineRenderer:SetPositionCount(count: int)Sets the number of line points.
SetPosition
Section titled “SetPosition”LineRenderer:SetPosition(index: int, position: Vector3)Changes one point. Unlike API arrays, this index starts at 0.
SetPositions
Section titled “SetPositions”LineRenderer:SetPositions(points: LuaTable)Replaces all points with values from a sequential Lua table. Up to 2048 points are supported.
Appearance
Section titled “Appearance”All setter methods below return nil.
| Method | Arguments | Description |
|---|---|---|
SetColor |
color: Color |
Sets the line color. |
SetWidth |
width: number |
Sets a constant width. |
SetDistanceWidth |
nearWidth, farWidth, nearDistance, farDistance: number |
Changes width linearly between near and far distances. |
SetOccludedVisibility |
brightness, transparency: number |
Controls portions occluded by geometry. Values are clamped to 0..1. |
SetPatternEnabled |
enabled: bool |
Enables or disables the texture pattern. |
SetPatternRepeat |
repeatCount: number |
Sets pattern repetitions along the line. |
SetPatternTexture |
texture: Texture |
Sets the pattern Texture. |
SetProgress |
progress: number |
Sets the completed line portion for materials with _Progress. |
SurfaceOverlay
Section titled “SurfaceOverlay”An area projected onto visible world surfaces.
Every method returns nil.
| Method | Arguments | Description |
|---|---|---|
SetPosition |
position: Vector3 |
Sets the area center in world space. |
SetSize |
size: Vector3 |
Sets the projected volume size. |
SetColor |
color: Color |
Sets color and transparency. |
SetFillBase |
fillBase: number |
Sets the base fill density. |
SetOcclusionEnabled |
enabled: bool |
Enables geometry occlusion masking. |
SetVisible |
visible: bool |
Shows or hides the area. |