Skip to content

format

typescript
Physics.SphereCastAll(ray, radius, maxDistance, mask, cast_trigger)

class: Physics

description

Performs a spherecast and returns all the hit objects.

This method casts a sphere-shaped ray in the scene to check for intersections with objects and stores the intersection information with all the objects.

parameter

param_nametypedescription
rayRayThe ray object to be cast.
radiusnumberThe radius of the sphere.
maxDistancenumberThe maximum distance the sphere is cast.
masknumberThe layers to perform collision detection on (bitwise operation).
cast_triggerQueryTriggerInteraction?Whether to perform collision detection with triggers.

return

typedescription
RaycastHit|undefinedReturns the intersection information with objects if there is an intersection, otherwise returns undefined.

code example