Legacy Documentation: Version 4.5.0

Script language:

  • JS
  • C#
  • Boo
Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

SweepTestAll(direction: Vector3, distance: float = Mathf.Infinity): RaycastHit[];
RaycastHit[] SweepTestAll(Vector3 direction, float distance = Mathf.Infinity);
def SweepTestAll(direction as Vector3, distance as float = Mathf.Infinity) as RaycastHit[]

Parameters

directionDirection to sweep the Rigidbody object.
distanceLength of the sweep.

Description

Like Rigidbody.SweepTest, but returns all hits.

The sweep may return multiple hits against the same collider if more then one of the rigidbody's attached colliders would hit it.

Note that this function only works when a primitive collider type (sphere, cube or capsule) is attached to the rigidbody object - mesh colliders will not work, although they can be detected in the scene by the sweep.