WorldDraw
Draw debug geometry and spawn lights, meshes, and textures in the world.
LuauMesh
Class
Luau Mesh
Properties
| Property | Type | Description |
|---|---|---|
vertices |
Array<Vec3> |
|
triangles |
Array<number> |
|
normals |
Array<Vec3> |
|
uVs |
Array<Vec2> |
|
texture |
LuauTexture? |
Optional. When nil the mesh renders solid color instead |
color |
LinearColor |
Solid color the mesh renders with when no texture is set (white by default). |
normalTexture |
LuauTexture? |
Optional normal map. Forced to linear (non-sRGB) sampling on draw. |
position |
Vec3 |
|
rotation |
Quat |
|
scale |
Vec3 |
Methods
| Method | Description |
|---|---|
draw |
Draw |
destroy |
Destroy and Remove |
draw
Draw
Returns: nil
destroy
Destroy and Remove
Returns: nil
LuauPointLight
Class
Spawns a dynamic point light in the world. This is intended for use in Luau camera scripts
Properties
| Property | Type | Description |
|---|---|---|
position |
Vec3 |
UFUNCTION(LuauCallable) static ALuauPointLight New(); static ULuauPointLight New(FVector Position, float Intensity, FVector Color); |
intensity |
number |
The brightness of the light |
color |
Vec3 |
The RGB color of the light, values are from 0-1 |
radius |
number |
The range of the light in world units. This is the distance at which the light's intensity will be reduced to 0. |
Methods
| Method | Description |
|---|---|
destroy |
Destroy and Remove |
destroy
Destroy and Remove
Returns: nil
LuauTexture
Class
Luau Texture
Static functions
| Method | Description |
|---|---|
fromBytes |
Decodes PNG / JPG / BMP (auto-detected from magic bytes) into a texture. Returns nil on failure. |
fromBytes
Decodes PNG / JPG / BMP (auto-detected from magic bytes) into a texture. Returns nil on failure.
Parameters
| Name | Type |
|---|---|
Bytes |
Array<number> |
Returns: LuauTexture?
WorldDraw
Class
Functions for drawing objects in the world on the local spectator client
Static functions
| Method | Description |
|---|---|
spawnPointLight |
Spawns a dynamic point light in the world. Returns nil if the light failed to spawn |
spawnMesh |
Spawns a mesh in the world |
drawTriangle |
Draws a triangle in space, color values are from 0-1, lifetime of 0 means it will not be cleared. |
drawPoint |
Draws a point in space. Points are scaled in screen space |
drawLine |
Draws a line in space |
clearLights |
Removes all custom spawned lights from the scene |
clearAll |
Clears all lines, points, lights, and meshes |
clear |
Clears all lines and points. Lights and meshes are left alone -- use clearAll() or destroy them individually. |
spawnPointLight
WorldDraw.spawnPointLight(Position: Vec3, Intensity: number, Color: Vec3, Radius: number) -> LuauPointLight?
Spawns a dynamic point light in the world. Returns nil if the light failed to spawn
Parameters
| Name | Type |
|---|---|
Position |
Vec3 |
Intensity |
number |
Color |
Vec3 |
Radius |
number |
Returns: LuauPointLight?
spawnMesh
Spawns a mesh in the world
Returns: LuauMesh?
drawTriangle
WorldDraw.drawTriangle(Point1: Vec3, Point2: Vec3, Point3: Vec3, Color: LinearColor, Lifetime: number) -> nil
Draws a triangle in space, color values are from 0-1, lifetime of 0 means it will not be cleared.
Parameters
| Name | Type | Description |
|---|---|---|
Point1 |
Vec3 |
|
Point2 |
Vec3 |
|
Point3 |
Vec3 |
|
Color |
LinearColor |
RGB color with values from 0-1 |
Lifetime |
number |
Lifetime of 0 means it will not be cleared |
Returns: nil
drawPoint
WorldDraw.drawPoint(Position: Vec3, R: number, G: number, B: number, PointSize: number, Lifetime: number) -> nil
Draws a point in space. Points are scaled in screen space
Parameters
| Name | Type | Description |
|---|---|---|
Position |
Vec3 |
|
R |
number |
Red value from 0-1 |
G |
number |
Green value from 0-1 |
B |
number |
Blue value from 0-1 |
PointSize |
number |
Size of the point in screen space |
Lifetime |
number |
Lifetime of 0 means it will not be cleared |
Returns: nil
drawLine
WorldDraw.drawLine(StartPos: Vec3, EndPos: Vec3, R: number, G: number, B: number, Thickness: number, Lifetime: number) -> nil
Draws a line in space
Parameters
| Name | Type | Description |
|---|---|---|
StartPos |
Vec3 |
|
EndPos |
Vec3 |
|
R |
number |
Red value from 0-1 |
G |
number |
Green value from 0-1 |
B |
number |
Blue value from 0-1 |
Thickness |
number |
Thickness of the line in world units |
Lifetime |
number |
Lifetime of 0 means it will not be cleared |
Returns: nil
clearLights
Removes all custom spawned lights from the scene
Returns: nil
clearAll
Clears all lines, points, lights, and meshes
Returns: nil
clear
Clears all lines and points. Lights and meshes are left alone -- use clearAll() or destroy them individually.
Returns: nil