AbstractRayCaster QML Type

3Dシーンにおけるレイキャスティングのための抽象基底クラス。詳細...

Import Statement: import Qt3D.Render 2.8
In C++: QAbstractRayCaster
Status: Deprecated

プロパティ

詳細説明

AbstractRayCasterは、3Dシーンに光線をキャストするための抽象基底クラスです。AbstractRayCasterは直接インスタンス化することはできず、サブクラスを通してインスタンス化します。QAbstractRayCaster は、実行モードやレイヤーの処理など、すべてのレイキャスターに共通のプロパティを指定しますが、実際のレイキャストの詳細はサブクラスに任せます。

レイキャスティングは、ピッキング(ObjectPicker を使用)とは異なり、トリガーにマウスイベントを必要としません。

デフォルトでは、AbstractRayCaster のインスタンスは無効になっています。有効にすると、指定されたレイはフレームごとにオブジェクトと交差しているかどうかテストされます。オブジェクトが見つからない場合でも、AbstractRayCaster.hits プロパティはレイキャストの結果で更新されます。

Qt3D.Render::PickingSettings を使用して、どのプリミティブをテストするか、結果をどのように返すかなど、レイキャストを制御することができます。

さらに、Qt3D.Render::Layerコンポーネントを使用して、エンティティやエンティティサブグラフがレイキャストにどのように反応するかを制御することができます。

注意:AbstractRayCasterから派生したコンポーネントは、複数のエンティティの量を共有するべきではありません。

Qt3D.Render::RayCaster,Qt3D.Render::ScreenRayCaster,Qt3D.Render::ObjectPicker,Qt3D.Render::PickingSettings,Qt3D.Render::NoPickingも参照してください

プロパティ ドキュメント

filterMode : enumeration

レイキャストテストのために選択するエンティティを指定するフィルタモードを保持します。

デフォルト値はAbstractRayCaster.AcceptMatchingLayers です。

定数説明
AcceptAnyMatchingLayersこのAbstractRayCaster に追加された 1 つ以上のLayer オブジェクトを参照するエンティティを受け入れる。これはデフォルトです。
AcceptAllMatchingLayersこのオブジェクトに追加されたすべてのLayer オブジェクトを参照するエンティティを受け入れる。AbstractRayCaster
DiscardAnyMatchingLayersこのオブジェクトに追加された1つ以上のLayer オブジェクトを参照するエンティティを破棄する。AbstractRayCaster
DiscardAllMatchingLayersこれに追加されたすべてのLayer オブジェクトを参照するエンティティを破棄する。AbstractRayCaster

hits : array [read-only]

最後のレイキャストテストの結果を、javascript オブジェクトの配列として保持します。オブジェクトに定義されているフィールドは、以下に定義されています。

{
    type // enum value of RayCasterHit.HitType
    entity // entity that was intersected
    distance // distance from ray origin to intersection
    localIntersection.x: // coordinate of intersection in the entity's coordinate system
    localIntersection.y
    localIntersection.z
    worldIntersection.x // coordinate of intersection in the model's coordinate system
    worldIntersection.y
    worldIntersection.z
    primitiveIndex // index of the primitive (triangle, line, point) that was intersected;
                   // (undefined if the picking mode is set to bounding volume)
    vertex1Index // index of the first point of the triangle or line that was intersected
                 // (undefined if the picking mode is set to bounding volume or points)
    vertex2Index // index of the second point of the triangle or line that was intersected
                 // (undefined if the picking mode is set to bounding volume or points)
    vertex3Index // index of the second point of the triangle that was intersected
                 // (undefined if the picking mode is set to bounding volume, points or lines)
}

連続したテストがまったく同じ結果(または空の結果)を返す場合でも、テストのたびに変更通知が発行されることに注意してください。


runMode : enumeration

レイキャストテストの実行頻度を制御する実行モードを保持します。

定数説明
Continuousコンポーネントが有効である限り、レイキャストは毎フレーム実行されます。
SingleShotレイキャストは一度実行されると、コンポーネントはそれ自体を無効にします。これはデフォルトの

© 2025 The Qt Company Ltd. Documentation contributions included herein are the copyrights of their respective owners. The documentation provided herein is licensed under the terms of the GNU Free Documentation License version 1.3 as published by the Free Software Foundation. Qt and respective logos are trademarks of The Qt Company Ltd. in Finland and/or other countries worldwide. All other trademarks are property of their respective owners.