يجب وضع محتوى الواقع المعزّز في وضعه وحجمه بشكل صحيح ليندمج في المشهد. مثل الكائنات في العالم الحقيقي، يجب أن تبدو الكائنات الافتراضية البعيدة أصغر حجمًا. يمكنك إجراء اختبار بالنتيجة (أو raycast في AR Foundation for Unity) لتحديد الموضع الصحيح لكائن ثلاثي الأبعاد في المشهد. يضمن الموضع الصحيح عرض محتوى الواقع المعزّز بالحجم المناسب (الواضح).
تعمل اختبارات النتائج على إيجاد التقاطعات بين الهندسة الثلاثية الأبعاد في العالم الحقيقي وأشعة افتراضية تتكون من أصل واتجاه. ويشيع استخدام الأشعة مع كاميرا الجهاز باعتبارها نقطة انطلاق، إلا أن ARCore يشتمل على واجهة برمجة تطبيقات لإجراء اختبارات النتائج باستخدام أشعة عشوائية في إحداثيات الفضاء في العالم.
تخيل أن هناك شعاعًا ينبعث من كاميرا جهاز المستخدم ويمتد للأمام حتى يصل إلى الشكل الهندسي الثلاثي الأبعاد للمشهد مثل أرضية أو جدار أو كائن. وبعد حدوث ذلك، ستتلقى قائمة بنتائج النتيجة، أو التقاطعات مع الأبعاد الهندسية للمشهد الذي تم اكتشافه. يتم فرز القائمة حسب المسافة من الجهاز، مع أقرب تقاطع أولاً. وهذا مهم لأنه بشكل عام لا يمكنك رؤية الكائنات المحجوبة خلف كائنات أخرى، وبالتالي تكون النتيجة الأولى هي الأكثر أهمية في أغلب الأحيان.
محتوى نتيجة النتيجة
يتم عرض نتيجة نتيجة فردية كقائمة مع المعلومات التالية لكل نتيجة:
المسافة من أصل الشعاع، بالمتر
وضع (موضع واتجاه) نتيجة النتيجة
الشكل الهندسي الثلاثي الأبعاد الذي تضربه، في شكل مخطط قابل للتتبع
هناك أربعة أنواع من نتائج النتائج: نتائج العمق، والمستوى المستوي، ونقطة الخصائص، والموضع الفوري. ولكل منها حالات الاستخدام والمفاضلات الخاصة به، كما هو موضح في الجدول التالي.
نوع نتيجة النتيجة
الوصف
الاتجاه
حالة الاستخدام
العمق
لاستخدام معلومات العمق من المشهد بأكمله لتحديد العمق والاتجاه الصحيحين للنقطة
عمودي مع السطح الثلاثي الأبعاد
وضع كائن افتراضي على سطح عشوائي (ليس فقط على الأرضيات والجدران)
ضَع كائنًا على سطح (أرضية أو جدار) باستخدام الشكل الهندسي الكامل للطائرة. يجب ضبط مقياس صحيح على الفور. احتياطي لاختبار نتائج العمق
نقطة مميّزة
يعتمد هذا الإعداد على الميزات المرئية حول نقطة نقر المستخدم لتحديد موضعها واتجاهها الصحيحَين.
عمودي مع السطح الثلاثي الأبعاد
وضع عنصر على سطح عشوائي (وليس على الأرضيات والجدران فقط)
موضع الإعلان الفوري (Raycast الدائم)
يستخدم مساحة الشاشة لوضع المحتوى. يستخدم التطبيق في البداية العمق المقدَّر الذي يوفره التطبيق. ويعمل بشكل فوري، ولكن سيتغير الوضع والعمق الفعلي بعد أن يتمكّن تطبيق ARCore من تحديد الشكل الهندسي للمشهد الفعلي.
+Y يشير لأعلى، عكس الجاذبية
يمكنك وضع جسم على سطح مستوٍ (أرضية أو حائط) باستخدام الشكل الهندسي الكامل للطائرة في حال كان الموضع السريع للطائرة مهمًّا، ويمكن أن تتحمّل التجربة العمق الأولي والمقياس غير المعروفَين.
تاريخ التعديل الأخير: 2025-07-26 (حسب التوقيت العالمي المتفَّق عليه)
[null,null,["تاريخ التعديل الأخير: 2025-07-26 (حسب التوقيت العالمي المتفَّق عليه)"],[[["\u003cp\u003eARCore 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.\u003c/p\u003e\n"],["\u003cp\u003eHit results provide distance, pose, and trackable information, allowing you to realistically anchor 3D content.\u003c/p\u003e\n"],["\u003cp\u003eThere 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.\u003c/p\u003e\n"],["\u003cp\u003eDepth 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.\u003c/p\u003e\n"],["\u003cp\u003eFeature Point hit results rely on visual features, and Instant Placement allows for fast content placement even with initially unknown depth and scale.\u003c/p\u003e\n"]]],[],null,["# Hit-tests place virtual objects in the real world\n\n**Platform-specific guides** \n\n### Android (Kotlin/Java)\n\n- [Developer guide](/ar/develop/java/hit-test/developer-guide)\n\n### Android NDK (C)\n\n- [Developer guide](/ar/develop/c/hit-test/developer-guide)\n\n### Unity (AR Foundation)\n\n- [Developer guide](/ar/develop/unity-arf/hit-test/developer-guide)\n\nYour browser does not support the video tag.\n\nAR content must be correctly placed and sized to blend into a scene. Like real-world objects, virtual objects that are further away should appear smaller. You can perform a **hit-test** (or a **raycast** in AR Foundation for Unity) to determine the correct placement of a 3D object in your scene. Correct placement ensures that the AR content is rendered at the appropriate (apparent) size.\n\nHit-tests find intersections between either real-world 3D geometry and a virtual ray consisting of an origin and direction. Rays with the device's camera as the origin are used most commonly, though ARCore includes an API for performing hit-tests with an arbitrary ray in world space coordinates.\n\nImagine that there is a ray originating from a user's device camera that extends forward until it hits the 3D geometry of the scene, such as a floor, wall, or object. Once this happens, you receive a list of **hit results**, or intersections with detected scene geometry. The list is sorted by distance from the device, with the nearest intersection first. This is important because generally you can't see objects occluded behind other objects, so most of the time the first result is the most significant.\n| **Note:** Hit-tests are typically performed as rays from the device or device camera, but it is possible to have an arbitrary ray origin and direction.\n\nContents of a hit result\n------------------------\n\nAn individual hit result is returned as a list with the following information for each result:\n\n- Distance from the ray origin, in meters\n- Pose (position and orientation) of the hit result\n- The 3D geometry that you hit, in the form of a Trackable\n\nYou can then use the desired hit result to [realistically place your 3D content using an Anchor](/ar/develop/anchors).\n\nHit result types\n----------------\n\nThere are four types of hit results: Depth, plane, feature point, and Instant Placement results. Each has its own use cases and tradeoffs, as shown by the following table.\n| **Note:** Depth hit results require [Depth supported devices](/ar/devices#google_play_devices). On non-Depth supported devices, Depth supported devices that do not have depth data yet or on sessions where Depth has been disabled, use plane hit results instead.\n\n| Hit result type | Description | Orientation | Use case |\n|----------------------------------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|-------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Depth | Uses depth information from the entire scene to determine a point's correct depth and orientation | Perpendicular to the 3D surface | Place a virtual object on an arbitrary surface (not just on floors and walls) |\n| Plane | Hits horizontal and/or vertical surfaces to determine a point's correct depth and orientation | Perpendicular to the 3D surface | Place an object on a plane (floor or wall) using the plane's full geometry. Need correct scale immediately. Fallback for the Depth hit-test |\n| Feature point | Relies on visual features around the point of a user tap to determine a point's correct position and orientation | Perpendicular to the 3D surface | Place an object on an arbitrary surface (not just on floors and walls) |\n| Instant Placement (Persistent Raycast) | Uses screen space to place content. Initially uses estimated depth provided by the app. Works instantly, but pose and actual depth will change once ARCore is able to determine actual scene geometry | +Y pointing up, opposite to gravity | Place an object on a plane (floor or wall) using the plane's full geometry where fast placement is critical, and the experience can tolerate unknown initial depth and scale |\n\nDevice compatibility\n--------------------\n\nHit-tests work on all [ARCore supported devices](/ar/devices), but Depth hit-tests will require [Depth supported devices](/ar/devices#google_play_devices).\n\nUse hit results to place AR content\n-----------------------------------\n\nOnce you have a hit result, you can use its pose as input to [place AR content](/ar/develop/anchors) in your scene."]]