Skip to main content

Rigidbody.SweepTestAll(Vector3 direction, number maxDistance = math.huge, QueryTriggerInteraction queryTriggerInteraction = QueryTriggerInteraction.UseGlobal)

Like Rigidbody.SweepTest, but returns all hits.

Parameters:

NameTypeDescription
directionVector3The direction into which to sweep the rigidbody.
maxDistancenumberThe length of the sweep.
queryTriggerInteractionQueryTriggerInteractionSpecifies whether this query should hit Triggers.

Returns:

typeDescription
RaycastHit[]An array of all colliders hit in the sweep.

Usage

---@type Rigidbody
local rigidbody;

---@type Vector3
local direction;

---@type number
local maxDistance;

---@type QueryTriggerInteraction
local queryTriggerInteraction;


local val0 = rigidbody.SweepTestAll(direction, maxDistance, queryTriggerInteraction)