AR コンテンツは、シーンに溶け込むように正しい配置とサイズにする必要があります。実世界の物体と同様に、遠くにある仮想オブジェクトは小さく表示される必要があります。ヒットテスト(または AR Foundation for Unity のレイキャスト)を実行すると、シーン内の 3D オブジェクトの正しい配置を判断できます。正しく配置することで、AR コンテンツが適切な(見かけの)サイズでレンダリングされます。
ヒットテストは、実世界の 3D ジオメトリと、原点と方向で構成される仮想直線との交差を検出します。デバイスのカメラを原点とする光線が最も一般的に使用されますが、ARCore には、ワールド空間座標の任意の光線を使用してヒットテストを実行するための API が含まれています。
ユーザーのデバイスのカメラから出た光線が、床、壁、物体などのシーンの 3D ジオメトリに当たるまで前方に延びるとします。この場合、ヒット結果のリスト、つまり検出されたシーン ジオメトリとの交差点が返されます。リストはデバイスからの距離の順に並べ替えられ、最も近い交差点が最初に表示されます。通常、他のオブジェクトの背後に隠れているオブジェクトは確認できないため、これは重要です。ほとんどの場合、最初の結果が最も重要な結果になります。
[[["わかりやすい","easyToUnderstand","thumb-up"],["問題の解決に役立った","solvedMyProblem","thumb-up"],["その他","otherUp","thumb-up"]],[["必要な情報がない","missingTheInformationINeed","thumb-down"],["複雑すぎる / 手順が多すぎる","tooComplicatedTooManySteps","thumb-down"],["最新ではない","outOfDate","thumb-down"],["翻訳に関する問題","translationIssue","thumb-down"],["サンプル / コードに問題がある","samplesCodeIssue","thumb-down"],["その他","otherDown","thumb-down"]],["最終更新日 2023-12-02 UTC。"],[[["ARCore hit-tests, or raycasts, help you determine the correct placement and scale of virtual objects in the real world by finding intersections between a ray and the scene's geometry."],["Hit results provide distance, pose, and trackable information, allowing you to realistically anchor 3D content."],["There are four hit result types: Depth, Plane, Feature Point, and Instant Placement, each with different use cases and tradeoffs depending on the desired outcome and device capabilities."],["Depth hit results, available on Depth supported devices, utilize depth information for precise object placement on any surface, while Plane hit results are suitable for floors and walls."],["Feature Point hit results rely on visual features, and Instant Placement allows for fast content placement even with initially unknown depth and scale."]]],[]]