🔍 Trace
Trace a ray against the world and get collided objects information.
🗿Static Class
This is a Static Class. Access it's methods directly with
.
. It's not possible to spawn new instances.💂Authority
This static class can be accessed only on 🟧 Client side.
🧑💻API Source
This page is auto-generated! The Functions, Properties and Events described here are defined in our GitHub's API Repository! Feel free to commit suggestions and changes to the source .json API files!
🎒 Examples
Client/Index.lua
-- Gets the local player
local local_player = Client.GetLocalPlayer()
-- Gets the camera rotation and location
local camera_rotation = local_player:GetCameraRotation()
local start_location = local_player:GetCameraLocation()
-- Calculates the direction vector based on the camera rotation
local direction = camera_rotation:GetForwardVector()
-- Calculates the end location of the trace
-- (start location + 20000 units in the direction of the camera)
local end_location = start_location + direction * 20000
-- Filter everything we want to trace (e.g. WorldStatic, WorldDynamic, PhysicsBody, Vehicle)
local collision_trace = CollisionChannel.WorldStatic | CollisionChannel.WorldDynamic | CollisionChannel.PhysicsBody | CollisionChannel.Vehicle
-- Define the parameters for the trace
-- TraceMode.TraceOnlyVisibility means we only want to trace against objects that are visible
-- TraceMode.DrawDebug means we want to draw debug lines for the trace for visualization
-- TraceMode.TraceComplex means we want to trace against complex collision shapes
-- TraceMode.ReturnEntity means we want to return the entity that was hit by the trace
local trace_mode = TraceMode.TraceOnlyVisibility | TraceMode.DrawDebug | TraceMode.TraceComplex | TraceMode.ReturnEntity
-- Do the trace
local trace_result = Trace.LineSingle(start_location, end_location, collision_trace, trace_mode)
-- If the trace was successful
if (trace_result.Success) then
-- And we got an entity, print the name of the collided entity, otherwise just print the location
if (trace_result.Entity) then
Console.Log("Trace Success! Entity: " .. trace_result.Entity:GetClass():GetName() .. ". Location: " .. tostring(trace_result.Location))
else
Console.Log("Trace Success! Location: " .. tostring(trace_result.Location))
end
else
-- If the trace was not successful, print a message
Console.Log("Failed to trace")
end
🗿 Static Functions
Returns | Name | Description | |
---|---|---|---|
table of table | BoxMulti | Trace a box against the world using object types and return overlapping hits and then first blocking hit | |
table | BoxSingle | Trace a box against the world and returns a table with the first blocking hit information | |
table of table | CapsuleMulti | Trace a capsule against the world using object types and return overlapping hits and then first blocking hit | |
table | CapsuleSingle | Trace a capsule against the world and returns a table with the first blocking hit information | |
table of table | LineMulti | Trace a ray against the world using object types and return overlapping hits and then first blocking hit | |
table | LineSingle | Trace a ray against the world and returns a table with the first blocking hit information | |
table of table | SphereMulti | Trace a sphere against the world using object types and return overlapping hits and then first blocking hit | |
table | SphereSingle | Trace a sphere against the world and returns a table with the first blocking hit information |

BoxMulti
Trace a box against the world using object types and return overlapping hits and then first blocking hit
Note: The Trace will collide with the ObjectType (in the Collision Settings), even if the channel is ignored below.
Results are sorted, so a blocking hit (if found) will be the last element of the array
Only the single closest blocking result will be generated, no tests will be done after that
— Returns table of table (with this format).
local ret = Trace.BoxMulti(start_location, end_location, half_size, orientation, collision_channel?, trace_mode?, ignored_actors?)
Type | Parameter | Default | Description |
---|---|---|---|
Vector | start_location | Required parameter | Start location of the box |
Vector | end_location | Required parameter | End location of the box |
Vector | half_size | Required parameter | Distance from the center of box along each axis |
Rotator | orientation | Required parameter | Orientation of the box |
CollisionChannel | collision_channel? | WorldStatic | Supports several channels separating by | (using bit-wise operations) |
TraceMode | trace_mode? | 0 | Trace Mode, pass all parameters separating by | (using bit-wise operations)You need to explicitly pass the modes to return the values you want |
table of Base Actor | ignored_actors? | {} | Array of actors to ignore during the trace |

BoxSingle
Trace a box against the world and returns a table with the first blocking hit information
Note: The Trace will collide with the ObjectType (in the Collision Settings), even if the channel is ignored below.
— Returns table (with this format).
local ret = Trace.BoxSingle(start_location, end_location, half_size, orientation, collision_channel?, trace_mode?, ignored_actors?)
Type | Parameter | Default | Description |
---|---|---|---|
Vector | start_location | Required parameter | Start location of the box |
Vector | end_location | Required parameter | End location of the box |
Vector | half_size | Required parameter | Distance from the center of box along each axis |
Rotator | orientation | Required parameter | Orientation of the box |
CollisionChannel | collision_channel? | WorldStatic | Supports several channels separating by | (using bit-wise operations) |
TraceMode | trace_mode? | 0 | Trace Mode, pass all parameters separating by | (using bit-wise operations)You need to explicitly pass the modes to return the values you want |
table of Base Actor | ignored_actors? | {} | Array of actors to ignore during the trace |

CapsuleMulti
Trace a capsule against the world using object types and return overlapping hits and then first blocking hit
Note: The Trace will collide with the ObjectType (in the Collision Settings), even if the channel is ignored below.
Results are sorted, so a blocking hit (if found) will be the last element of the array
Only the single closest blocking result will be generated, no tests will be done after that
— Returns table of table (with this format).
local ret = Trace.CapsuleMulti(start_location, end_location, radius, half_height, collision_channel?, trace_mode?, ignored_actors?)
Type | Parameter | Default | Description |
---|---|---|---|
Vector | start_location | Required parameter | Start location of the capsule |
Vector | end_location | Required parameter | End location of the capsule |
float | radius | Required parameter | Radius of the capsule to sweep |
float | half_height | Required parameter | Distance from center of capsule to tip of hemisphere endcap. |
CollisionChannel | collision_channel? | WorldStatic | Supports several channels separating by | (using bit-wise operations) |
TraceMode | trace_mode? | 0 | Trace Mode, pass all parameters separating by | (using bit-wise operations)You need to explicitly pass the modes to return the values you want |
table of Base Actor | ignored_actors? | {} | Array of actors to ignore during the trace |

CapsuleSingle
Trace a capsule against the world and returns a table with the first blocking hit information
Note: The Trace will collide with the ObjectType (in the Collision Settings), even if the channel is ignored below.
— Returns table (with this format).
local ret = Trace.CapsuleSingle(start_location, end_location, radius, half_height, collision_channel?, trace_mode?, ignored_actors?)
Type | Parameter | Default | Description |
---|---|---|---|
Vector | start_location | Required parameter | Start location of the capsule |
Vector | end_location | Required parameter | End location of the capsule |
float | radius | Required parameter | Radius of the capsule to sweep |
float | half_height | Required parameter | Distance from center of capsule to tip of hemisphere endcap. |
CollisionChannel | collision_channel? | WorldStatic | Supports several channels separating by | (using bit-wise operations) |
TraceMode | trace_mode? | 0 | Trace Mode, pass all parameters separating by | (using bit-wise operations)You need to explicitly pass the modes to return the values you want |
table of Base Actor | ignored_actors? | {} | Array of actors to ignore during the trace |

LineMulti
Trace a ray against the world using object types and return overlapping hits and then first blocking hit
Note: The Trace will collide with the ObjectType (in the Collision Settings), even if the channel is ignored below.
Results are sorted, so a blocking hit (if found) will be the last element of the array
Only the single closest blocking result will be generated, no tests will be done after that
— Returns table of table (with this format).
local ret = Trace.LineMulti(start_location, end_location, collision_channel?, trace_mode?, ignored_actors?)
Type | Parameter | Default | Description |
---|---|---|---|
Vector | start_location | Required parameter | Start location of the ray |
Vector | end_location | Required parameter | End location of the ray |
CollisionChannel | collision_channel? | WorldStatic | Supports several channels separating by | (using bit-wise operations) |
TraceMode | trace_mode? | 0 | Trace Mode, pass all parameters separating by | (using bit-wise operations)You need to explicitly pass the modes to return the values you want |
table of Base Actor | ignored_actors? | {} | Array of actors to ignore during the trace |

LineSingle
Trace a ray against the world and returns a table with the first blocking hit information
Note: The Trace will collide with the ObjectType (in the Collision Settings), even if the channel is ignored below.
— Returns table (with this format).
local ret = Trace.LineSingle(start_location, end_location, collision_channel?, trace_mode?, ignored_actors?)
Type | Parameter | Default | Description |
---|---|---|---|
Vector | start_location | Required parameter | Start location of the ray |
Vector | end_location | Required parameter | End location of the ray |
CollisionChannel | collision_channel? | WorldStatic | Supports several channels separating by | (using bit-wise operations) |
TraceMode | trace_mode? | 0 | Trace Mode, pass all parameters separating by | (using bit-wise operations)You need to explicitly pass the modes to return the values you want |
table of Base Actor | ignored_actors? | {} | Array of actors to ignore during the trace |

SphereMulti
Trace a sphere against the world using object types and return overlapping hits and then first blocking hit
Note: The Trace will collide with the ObjectType (in the Collision Settings), even if the channel is ignored below.
Results are sorted, so a blocking hit (if found) will be the last element of the array
Only the single closest blocking result will be generated, no tests will be done after that
— Returns table of table (with this format).
local ret = Trace.SphereMulti(start_location, end_location, radius, collision_channel?, trace_mode?, ignored_actors?)
Type | Parameter | Default | Description |
---|---|---|---|
Vector | start_location | Required parameter | Start location of the sphere |
Vector | end_location | Required parameter | End location of the sphere |
float | radius | Required parameter | Radius of the sphere |
CollisionChannel | collision_channel? | WorldStatic | Supports several channels separating by | (using bit-wise operations) |
TraceMode | trace_mode? | 0 | Trace Mode, pass all parameters separating by | (using bit-wise operations)You need to explicitly pass the modes to return the values you want |
table of Base Actor | ignored_actors? | {} | Array of actors to ignore during the trace |

SphereSingle
Trace a sphere against the world and returns a table with the first blocking hit information
Note: The Trace will collide with the ObjectType (in the Collision Settings), even if the channel is ignored below.
— Returns table (with this format).
local ret = Trace.SphereSingle(start_location, end_location, radius, collision_channel?, trace_mode?, ignored_actors?)
Type | Parameter | Default | Description |
---|---|---|---|
Vector | start_location | Required parameter | Start location of the sphere |
Vector | end_location | Required parameter | End location of the sphere |
float | radius | Required parameter | Radius of the sphere |
CollisionChannel | collision_channel? | WorldStatic | Supports several channels separating by | (using bit-wise operations) |
TraceMode | trace_mode? | 0 | Trace Mode, pass all parameters separating by | (using bit-wise operations)You need to explicitly pass the modes to return the values you want |
table of Base Actor | ignored_actors? | {} | Array of actors to ignore during the trace |
🚀 Events
This class doesn't have own events.