ar-hit-test
このコンポーネントは、WebXR hit-test API
を使用して、仮想オブジェクトを実世界に配置するものです。動作させるためには、オプションの hit-test
機能を要求することを忘れないでください。
このコンポーネントを scene
要素に追加すると、ユーザーが Augmented Reality
内で画面をタップするか、コントローラで選択すると、ユーザーが現実世界のどこを指しているのかを判断し、そこにレティクルを配置してイベントを発生させることができます。
If you have set a target property to be an element it will automatically make the reticle to be the same size as the footprint of the target and then when the user selects the object will be telepoted there. It will also set the visible state of the object to true so you can hide the object until the user has placed it for the first time. The hide-on-enter-ar
component is useful for that.
target
プロパティを要素に設定すると、レティクルは自動的にターゲットのフットプリントと同じサイズになり、ユーザーが選択するとオブジェクトがそこにテレポートされます。また、オブジェクトの可視状態を true
に設定するので、ユーザが初めて配置するまではオブジェクトを隠すことができます。その際に便利なのが、hide-on-enter-ar
コンポーネントです。
このコンポーネントの有効状態を切り替えることで、準備が整うまで何もインタラクションを行わないようにすることができます。
# 例
<a-scene webxr="optionalFeatures: hit-test;" ar-hit-test="target:#myobject;">
<a-entity id="myobject"></a-entity>
# Properties
Property | 概要 | デフォルト値 |
---|---|---|
target | 移動させるオブジェクト | null |
enabled | ヒットテストを行うかどうか | true |
src | レティクルに使用する画像 | See: Assets |
type | 'footprint' or 'map' footprint はモデルの形状です | "footprint" |
footprintDepth | 足跡に使用されるモデルの量、1 は高さが100%の状態です | 0.1 |
mapSize | ターゲットが設定されていない場合は、マップのサイズになります | 0.5 0.5 |
# Events
Event Name | Description |
---|---|
ar-hit-test-start | AR ヒット・テスト・システムがスキャンを開始しました。 |
ar-hit-test-achieved | AR ヒットテストシステムがヒットテストを開始するサーフェイスを見つけることができました。 |
ar-hit-test-select | ユーザーが位置決めを停止した場合、最新の位置、方向、および使用された入力ソースを含む詳細が表示されます。 |
# Assets
← Animation background →