Stay organized with collections
Save and categorize content based on your preferences.
ARRaycastManagerExtensions
Extensions to AR Foundation's ARRaycastManager
class.
Summary
Public static functions
RaycastStreetscapeGeometry
bool RaycastStreetscapeGeometry(
this ARRaycastManager raycastManager,
Vector2 screenPoint,
ref List< XRRaycastHit > raycastResults
)
Performs a raycast against ARStreetscapeGeometry
s being tracked by ARCore.
Outputs all intersections along the ray sorted in ascending order of distance. Accepts Unity's native 2D screen coordinate (0, 0) starting from the bottom left.
Details |
Parameters |
raycastManager
|
The ARRaycastManager this method extends.
|
screenPoint
|
2D screen touch position in Unity screen coordinates.
|
raycastResults
|
A list of XRRaycastHit if the raycast is successful.
|
|
Returns
|
true if the raycast had a hit, otherwise false .
|
RaycastStreetscapeGeometry
bool RaycastStreetscapeGeometry(
this ARRaycastManager raycastManager,
Ray ray,
ref List< XRRaycastHit > raycastResults
)
Performs a raycast against ARStreetscapeGeometry
s being tracked by ARCore.
Outputs all intersections along the ray sorted in ascending order of distance. Accepts Unity's native 3D coordinates.
Details |
Parameters |
raycastManager
|
The ARRaycastManager this methods extends.
|
ray
|
Ray for the origin and direction of the raycast.
|
raycastResults
|
A list of XRRaycastHit if the raycast is successful.
|
|
Returns
|
true if the raycast had a hit, otherwise false .
|
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2025-07-14 UTC.
[null,null,["Last updated 2025-07-14 UTC."],[[["\u003cp\u003eARRaycastManagerExtensions provides methods to perform raycasts against ARStreetscapeGeometry tracked by ARCore.\u003c/p\u003e\n"],["\u003cp\u003eRaycastStreetscapeGeometry function can be used with either screen point or a ray in 3D space.\u003c/p\u003e\n"],["\u003cp\u003eBoth versions of RaycastStreetscapeGeometry return a list of XRRaycastHit if the raycast is successful and true boolean value, otherwise false.\u003c/p\u003e\n"],["\u003cp\u003eResults are sorted in ascending order of distance from the ray origin.\u003c/p\u003e\n"]]],[],null,["# ARRaycastManagerExtensions Class Reference\n\nARRaycastManagerExtensions\n==========================\n\nExtensions to AR Foundation's `ARRaycastManager` class.\n\nSummary\n-------\n\n| ### Public static functions ||\n|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [RaycastStreetscapeGeometry](#raycaststreetscapegeometry)`(this `[ARRaycastManager](https://docs.unity3d.com/Packages/com.unity.xr.arfoundation@4.2/api/UnityEngine.XR.ARFoundation.ARRaycastManager.html)` raycastManager, `[Vector2](https://docs.unity3d.com/ScriptReference/Vector2.html)` screenPoint, ref List\u003c `[XRRaycastHit](https://docs.unity3d.com/Packages/com.unity.xr.arsubsystems@4.2/api/UnityEngine.XR.ARSubsystems.XRRaycastHit.html)` \u003e raycastResults)` | `bool` Performs a raycast against [ARStreetscapeGeometry](/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/ARStreetscapeGeometry#classGoogle_1_1XR_1_1ARCoreExtensions_1_1ARStreetscapeGeometry)s being tracked by ARCore. |\n| [RaycastStreetscapeGeometry](#raycaststreetscapegeometry)`(this `[ARRaycastManager](https://docs.unity3d.com/Packages/com.unity.xr.arfoundation@4.2/api/UnityEngine.XR.ARFoundation.ARRaycastManager.html)` raycastManager, `[Ray](https://docs.unity3d.com/ScriptReference/Ray.html)` ray, ref List\u003c `[XRRaycastHit](https://docs.unity3d.com/Packages/com.unity.xr.arsubsystems@4.2/api/UnityEngine.XR.ARSubsystems.XRRaycastHit.html)` \u003e raycastResults)` | `bool` Performs a raycast against [ARStreetscapeGeometry](/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/ARStreetscapeGeometry#classGoogle_1_1XR_1_1ARCoreExtensions_1_1ARStreetscapeGeometry)s being tracked by ARCore. |\n\nPublic static functions\n-----------------------\n\n### RaycastStreetscapeGeometry\n\n```c#\nbool RaycastStreetscapeGeometry(\n this ARRaycastManager raycastManager,\n Vector2 screenPoint,\n ref List\u003c XRRaycastHit \u003e raycastResults\n)\n``` \nPerforms a raycast against [ARStreetscapeGeometry](/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/ARStreetscapeGeometry#classGoogle_1_1XR_1_1ARCoreExtensions_1_1ARStreetscapeGeometry)s being tracked by ARCore.\n\nOutputs all intersections along the ray sorted in ascending order of distance. Accepts Unity's native 2D screen coordinate (0, 0) starting from the bottom left.\n\n\n| Details ||\n|-------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Parameters | |------------------|--------------------------------------------------------| | `raycastManager` | The `ARRaycastManager` this method extends. | | `screenPoint` | 2D screen touch position in Unity screen coordinates. | | `raycastResults` | A list of `XRRaycastHit` if the raycast is successful. | |\n| **Returns** | `true` if the raycast had a hit, otherwise `false`. |\n\n### RaycastStreetscapeGeometry\n\n```c#\nbool RaycastStreetscapeGeometry(\n this ARRaycastManager raycastManager,\n Ray ray,\n ref List\u003c XRRaycastHit \u003e raycastResults\n)\n``` \nPerforms a raycast against [ARStreetscapeGeometry](/ar/reference/unity-arf/class/Google/XR/ARCoreExtensions/ARStreetscapeGeometry#classGoogle_1_1XR_1_1ARCoreExtensions_1_1ARStreetscapeGeometry)s being tracked by ARCore.\n\nOutputs all intersections along the ray sorted in ascending order of distance. Accepts Unity's native 3D coordinates.\n\n\n| Details ||\n|-------------|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| Parameters | |------------------|--------------------------------------------------------| | `raycastManager` | The `ARRaycastManager` this methods extends. | | `ray` | Ray for the origin and direction of the raycast. | | `raycastResults` | A list of `XRRaycastHit` if the raycast is successful. | |\n| **Returns** | `true` if the raycast had a hit, otherwise `false`. |"]]