Skip to content

format

typescript
Physics.BoxCastAll(center, extents, rotation, direction, maxDistance, mask, cast_trigger)

class: Physics

description

Performs a boxcast and returns all the hit objects.

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

parameter

param_nametypedescription
centerVector3The center position of the box.
extentsVector3The size of the box.
rotationQuaternionThe rotation of the box.
directionVector3The direction in which the box is cast.
maxDistancenumberThe maximum distance the box is cast.
masknumberThe layers to perform collision detection with (bitwise operation).
cast_triggerQueryTriggerInteraction?Whether to perform collision detection with triggers.

return

typedescription
RaycastHit|undefinedReturns a RaycastHit object if the ray intersects with an object, otherwise returns undefined.

code example