# 3. Plane Detection and Raycasts
Part of [[AR Foundation]]. Prev: [[2. AR Session and XR Origin]]. Next: [[4. Touch Input and Session State]].
## 3.1 Managers on the Origin
Official [AR Raycast Manager](https://docs.unity3d.com/Packages/
[email protected]/manual/features/raycasts/arraycastmanager.html): add **AR Raycast Manager** to the **XR Origin** GameObject. Disable the component when you do not need raycasts (official: can improve performance). Official: if the device does not support raycasting, the component disables itself during `OnEnable`.
For a placement lab you also want planes to exist. Add an **AR Plane Manager** (official fallback-raycast page: add AR Plane Manager, and optionally bounding-box or point-cloud managers, in addition to the Raycast Manager). Confirm the exact Add Component title in 6.5.1. Official fallback: if a provider does not implement plane raycasts, the Raycast Manager can fall back to a **physics-based** raycast for some trackable types when those managers are present.
Do not add a second Raycast Manager or a second Origin.
## 3.2 Single raycasts (official)
Official [Single ray casts](https://docs.unity3d.com/Packages/
[email protected]/manual/features/raycasts/single-raycasts.html): use these for a one-time interaction such as placing a preview object on a detected surface. Two official methods on `ARRaycastManager`:
- **Viewport / screen point:** `Raycast(Vector2 screenPoint, List<ARRaycastHit> hitResults, TrackableType trackableTypes = …)` — `screenPoint` is in **device screen pixels**. Returns `true` if something in `trackableTypes` was hit. Official: `hitResults` is **replaced** with results, **closest first**.
- **World ray:** `Raycast(Ray ray, List<ARRaycastHit> hitResults, TrackableType trackableTypes = …)` — a Unity world-space `Ray`.
`TrackableType` values: confirm the plane flag you need in the 6.5.1 single-raycasts page and IntelliSense (commonly a plane-within-polygon style flag). Do not invent a flag name if IntelliSense does not show it.
## 3.3 What a hit contains (official `ARRaycastHit` 6.5.1)
| Property | Meaning |
|---|---|
| `pose` | `Pose` of the intersection in **Unity world space** |
| `distance` | Distance in Unity world space |
| `hitType` | `TrackableType` of the thing hit |
| `trackable` | The `ARTrackable`, or null; official sample casts to `ARPlane` |
Official sample pattern:
```csharp
using UnityEngine.XR.ARFoundation;
void HandleRaycast(ARRaycastHit hit)
{
if (hit.trackable is ARPlane plane)
Debug.Log(