Skip to content

格式

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

所属类: Physics

描述

进行盒体射线检测并返回相交的所有命中对象。

该方法会在场景中发射一个盒体的射线,检测盒体与物体是否相交,并存储与所有物体的相交信息。

参数

参数名类型描述
centerVector3盒体的中心位置
extentsVector3盒体的范围
rotationQuaternion盒体的旋转
directionVector3盒体投射的方向
maxDistancenumber盒体投射的最大距离
masknumber进行碰撞检测的层级(位运算)
cast_triggerQueryTriggerInteraction?射线是否与触发器进行碰撞检测

返回值

类型描述
RaycastHit|undefined射线是否与物体相交,若没有相交则返回undefined

代码示例