Version: 5.3 (switch to 5.4b)
언어English
  • C#
  • JS

Script language

Select your preferred scripting language. All code snippets will be displayed in this language.

Physics.RaycastNonAlloc

Suggest a change

Success!

Thank you for helping us improve the quality of Unity Documentation. Although we cannot accept all submissions, we do read each suggested change from our users and will make updates where applicable.

닫기

Submission failed

For some reason your suggested change could not be submitted. Please <a>try again</a> in a few minutes. And thank you for taking the time to help us improve the quality of Unity Documentation.

닫기

취소

Switch to Manual
public static function RaycastNonAlloc(ray: Ray, results: RaycastHit[], maxDistance: float = Mathf.Infinity, layerMask: int = DefaultRaycastLayers, queryTriggerInteraction: QueryTriggerInteraction = QueryTriggerInteraction.UseGlobal): int;
public static int RaycastNonAlloc(Ray ray, RaycastHit[] results, float maxDistance = Mathf.Infinity, int layerMask = DefaultRaycastLayers, QueryTriggerInteraction queryTriggerInteraction = QueryTriggerInteraction.UseGlobal);

파라미터

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 Layer mask는 레이 캐스팅 시에 콜라이더를 선택적으로 무시하는데 사용됩니다.
queryTriggerInteraction Specifies whether this query should hit Triggers.

Returns

int The amount of hits stored into the results buffer.

Description

Scene을 통해 레이 캐스팅을 하고 모든 충돌을 반환합니다. 순서가 보장되지 않는것을 유의하십시오.

Like Physics.RaycastAll, but generates no garbage.


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

파라미터

origin 시작점과 레이의 방향.
results The buffer to store the hits into.
direction 레이의 방향.
maxDistance The max distance the rayhit is allowed to be from the start of the ray.
layermask Layer mask는 레이 캐스팅 시에 콜라이더를 선택적으로 무시하는데 사용됩니다.
queryTriggerInteraction Specifies whether this query should hit Triggers.

Returns

int The amount of hits stored into the results buffer.

Description

Scene을 통해 레이 캐스팅을 하고 모든 충돌을 반환합니다. 순서가 보장되지 않는것을 유의하십시오.