Skip to content

format

typescript
Rigidbody.SweepTest(direction, maxDistance)

class: Rigidbody

description

Test if the rigidbody will collide with any objects when moving in the scene.

Returns true if the rigidbody scans and overlaps with any colliders, otherwise returns false.

parameter

param_nametypedescription
directionVector3The direction in which the rigidbody is scanned.
maxDistancenumber?The distance of the scan.

reture

typedescription
RaycastHit|undefinedWhether the rigidbody will collide with any objects.

code example