Version: 2017.1

Physics.RaycastNonAlloc

매뉴얼로 전환
public static int RaycastNonAlloc (Ray ray, RaycastHit[] results, float maxDistance= Mathf.Infinity, int layerMask= DefaultRaycastLayers, QueryTriggerInteraction queryTriggerInteraction= QueryTriggerInteraction.UseGlobal);

파라미터

ray The starting point and direction of the ray.
results The buffer to store the hits into.
maxDistance The max distance the rayhit is allowed to be from the start of the ray.
layerMask A Layer mask that is used to selectively ignore colliders when casting a ray.
queryTriggerInteraction Specifies whether this query should hit Triggers.

반환

int The amount of hits stored into the results buffer.

설명

Cast a ray through the scene and store the hits into the buffer.

Like Physics.RaycastAll, but generates no garbage.


public static int RaycastNonAlloc (Vector3 origin, Vector3 direction, RaycastHit[] results, float maxDistance= Mathf.Infinity, int layermask= DefaultRaycastLayers, QueryTriggerInteraction queryTriggerInteraction= QueryTriggerInteraction.UseGlobal);

파라미터

origin The starting point and direction of the ray.
results The buffer to store the hits into.
direction The direction of the ray.
maxDistance The max distance the rayhit is allowed to be from the start of the ray.
layermask A Layer mask that is used to selectively ignore colliders when casting a ray.
queryTriggerInteraction Specifies whether this query should hit Triggers.

반환

int The amount of hits stored into the results buffer.

설명

Cast a ray through the scene and store the hits into the buffer.