Skip to content

Raycasts

Provides client raycasting functionality.

Gets the direction for a raycast, given a camera direction and spread value.

NameTypeDefaultDescription
directionVector3The initial camera direction.
spreadnumberThe spread value.

Vector3

Determines the target position where a ray would land if it does not hit anything.

NameTypeDefaultDescription
originVector3The origin.
directionVector3The direction.
rangenumberThe range.

Vector3

Returns the default RaycastParams that should be used for item raycasts.

NameTypeDefaultDescription
...ignore...InstanceInstances to ignore. This is a var arg so you may specify multiple instances.

RaycastParams

Returns the origin to use for an action.

Vector3

Returns the direction, without spread, to use for an action.

Vector3

NameTypeDefaultDescription
paramsRaycastParamsThe RaycastParams to use.
originVector3The origin.
directionVector3The direction, adjusted for spread.
rangenumberThe range.
checkInitialOverlapboolean?If true, the origin volume will be checked for hits. Typically used for melee weapons.
fallbackToBlockcastboolean?If true, a blockcast will be used if no hit is found by a raycast. Typically used for melee weapons.

BehaviourTypes.HitscanResult