Raycast

The Raycast library provides raycasting utilities for detecting entities and surfaces.

Side: Client

Functions

Cam

Performs a raycast from the gameplay camera forward.

local hit, entityHit, coords, surfaceNormal, materialHash = Bridge.Raycast.Cam(distance, flags)
ParameterTypeDescription
distancenumberMaximum ray distance
flagsnumberEntity type flags (optional)

Returns: hit (boolean), entityHit (number), coords (vector3), surfaceNormal (vector3), materialHash (number)

Entity

Performs a raycast from one position to another.

local hit, entityHit, coords, surfaceNormal, materialHash = Bridge.Raycast.Entity(startPos, endPos, flags, ignoreEntity)
ParameterTypeDescription
startPosvector3Ray start position
endPosvector3Ray end position
flagsnumberEntity type flags
ignoreEntitynumberEntity to ignore (optional)

Returns: hit (boolean), entityHit (number), coords (vector3), surfaceNormal (vector3), materialHash (number)