Version: 2023.2
言語: 日本語
public RaycastHit2D GetRayIntersection (Ray ray, float distance, int layerMask= Physics2D.DefaultRaycastLayers);

パラメーター

ray テストすべき Ray を定義づける原点と方向
distance The maximum distance over which to cast the ray.
layerMask The LayerMask filter used to select which layers to detect Colliders for.

戻り値

RaycastHit2D The ray intersection result.

説明

Cast a 3D ray against the 2D Colliders in the Scene.

This function acts as a 3D "ray cast" but specifically designed to detect 2D Colliders. It achieved this by projecting the 3D ray into 2D space and then performs the 2D intersection test, ordering the results by the Z direction of the original 3D ray.


public int GetRayIntersection (Ray ray, float distance, List<RaycastHit2D> results, int layerMask= Physics2D.DefaultRaycastLayers);

パラメーター

ray テストすべき Ray を定義づける原点と方向
distance The maximum distance over which to cast the ray.
results The list to receieve results.
layerMask The LayerMask filter used to select which layers to detect Colliders for.

戻り値

int The number of RaycastHit2D results returned.

説明

Cast a 3D ray against the 2D Colliders in the Scene.

This function acts as a 3D "ray cast" but specifically designed to detect 2D Colliders. It achieved this by projecting the 3D ray into 2D space and then performs the 2D intersection test, ordering the results by the Z direction of the original 3D ray.


public int GetRayIntersection (Ray ray, float distance, RaycastHit2D[] results, int layerMask= Physics2D.DefaultRaycastLayers);

パラメーター

ray テストすべき Ray を定義づける原点と方向
distance The maximum distance over which to cast the ray.
results The array to receive results. The size of the array determines the maximum number of results that can be returned.
layerMask The LayerMask filter used to select which layers to detect Colliders for.

戻り値

int The number of RaycastHit2D results returned.

説明

Cast a 3D ray against the 2D Colliders in the Scene.

This function acts as a 3D "ray cast" but specifically designed to detect 2D Colliders. It achieved this by projecting the 3D ray into 2D space and then performs the 2D intersection test, ordering the results by the Z direction of the original 3D ray.

Copyright © 2023 Unity Technologies
优美缔软件(上海)有限公司 版权所有
"Unity"、Unity 徽标及其他 Unity 商标是 Unity Technologies 或其附属机构在美国及其他地区的商标或注册商标。其他名称或品牌是其各自所有者的商标。
公安部备案号:
31010902002961