Version: 2022.3

Physics.CapsuleCastNonAlloc

切换到手册
public static int CapsuleCastNonAlloc (Vector3 point1, Vector3 point2, float radius, Vector3 direction, RaycastHit[] results, float maxDistance= Mathf.Infinity, int layerMask= DefaultRaycastLayers, QueryTriggerInteraction queryTriggerInteraction= QueryTriggerInteraction.UseGlobal);

参数

point1 胶囊体在 start 处的球体中心。
point2 胶囊体在 end 处的球体中心。
radius 胶囊体的半径。
direction 扫描胶囊体的方向。
results 用于存储命中对象的缓冲区。
maxDistance 扫描的最大长度。
layerMask 层遮罩,用于在投射胶囊体时有选择地忽略碰撞体。
queryTriggerInteraction 指定该查询是否应该命中触发器。

返回

int 存储到缓冲区的命中对象数量。

描述

向场景中的所有碰撞体投射胶囊体,并在缓冲区中返回有关命中对象的详细信息。

Physics.CapsuleCastAll 类似,但不产生任何垃圾。


Did you find this page useful? Please give it a rating: