Difference between revisions of "Raycast One (LogiX node)/ja"
(Created page with "<code>Root</code> は、<code>Origin</code>, <code>Direction</code>, <code>MaxDistance</code> が計算されるローカル座標空間の基準スロットを定義する入...") |
(Created page with "=== 出力 === <code>OnHit</code> 出力は、レイがキャストされたときに有効なターゲットコライダーがヒットした場合にインパルスを出力...") |
||
Line 44: | Line 44: | ||
<code>Root</code> は、<code>Origin</code>, <code>Direction</code>, <code>MaxDistance</code> が計算されるローカル座標空間の基準スロットを定義する入力項目です。 | <code>Root</code> は、<code>Origin</code>, <code>Direction</code>, <code>MaxDistance</code> が計算されるローカル座標空間の基準スロットを定義する入力項目です。 | ||
− | === | + | === 出力 === |
− | + | <code>OnHit</code> 出力は、レイがキャストされたときに有効なターゲットコライダーがヒットした場合にインパルスを出力します。 | |
Revision as of 08:03, 15 February 2022
Raycast One | ||
---|---|---|
Inputs | ||
Impulse | Raycast | |
Float3 | Origin | |
Float3 | Direction | |
Float | MaxDistance | |
Bool | HitTriggers | |
Bool | UsersOnly | |
Float | DebugDuration | |
Slot | Root | |
Outputs | ||
Impulse | OnHit | |
Impulse | OnMiss | |
ICollider | HitCollider | |
Float | HitDistance | |
Float3 | HitPoint | |
Float3 | HitNormal | |
Int | HitTriangleIndex |
Raycast Oneノードは Raycast
へインパルスを入力するとレイキャストを実行します。レイキャストのプロパティは様々な入力によって制御され、最初のコライダのヒットに関する情報はノードの出力によって提供されます。
== 使用方法
入力
Origin
は、レイがキャストされるポイントを定義します。この値は、入力された Root
スロットの ローカル座標空間からの相対値として扱われます。デフォルトは [0;0;0] です。
Direction
は、レイがキャストされる方向ベクトルを定義します。この値は入力されたRoot
スロットのローカル座標空間からの相対値として扱われます。この入力は、デフォルトが[0;0;0]であるため、値を設定することが必要です。
MaxDistance
はレイキャストの最大長を制御します。レイキャストの実際の長さは、この入力と入力されたRoot
スロットのグローバルスケールの両方によって影響されます。デフォルト値は非常に大きい (~3.4×1038) ので、これを設定することが推奨されます。
HitTriggers
は、コライダーType
フィールドがTrigger
またはHapticTrigger
として設定されているコライダーコンポーネントのみを有効なヒットターゲットとしてみなすかを決定するものです。デフォルトはfalseです。
UsersOnly
は、アクティブなユーザーを持たないコライダーを有効なヒットターゲットとみなすかどうかを決定します。デフォルトはfalseで、この場合すべてのコライダーが有効なヒットターゲットとみなされます(他の要因に依存します)。しかし、trueに設定すると、アクティブなユーザーを持つ(つまり、ユーザーのスロット階層の下で子になっている)コライダーだけが、有効なヒットターゲットとみなされます。
DebugDuration
入力は、レイキャストデバッグビジュアルが持続する時間を決定します。この値は秒単位ですが、0 (デフォルト) に設定された場合、ビジュアルは1フレーム間持続します。負の値に設定された場合、デバッグビジュアルは描画されません。
Root
は、Origin
, Direction
, MaxDistance
が計算されるローカル座標空間の基準スロットを定義する入力項目です。
出力
OnHit
出力は、レイがキャストされたときに有効なターゲットコライダーがヒットした場合にインパルスを出力します。
The OnMiss
output fires an impulse if no valid targets are hit when a ray is cast.
The HitCollider
output provides the first valid target collider hit along the path of the raycast. This value is only available for the duration of the impulse chain started from OnHit
. Default is null.
The HitDistance
output provides the global distance between the raycast origin and the HitPoint
. This value is only available for the duration of the impulse chain started from OnHit
. Default is 0.
The HitPoint
output provides the global coordinates of the point where raycast first intersects with the HitCollider
. This value is only available for the duration of the impulse chain started from OnHit
. Default is [0;0;0].
The HitNormal
output provides the normal vector for the intersection of the raycast and the HitCollider
.
The HitTriangleIndex
outputs the index of the mesh triangle which was hit in the case that the HitCollider
is a MeshCollider (Component).
Notes
Colliders will generally be valid hit targets for raycasts unless their Type
enum field is set to Trigger
, HapticTrigger
, or HapticSampler
, though see details for the HitTriggers
input. Colliders will not be valid targets if the IgnoreRaycasts
bool is set to false on the collider component.