Raycasting and Hit-Testing

Find points on real-world surfaces given a screen location.

Overview

Raycasting is the preferred method for finding positions on surfaces in the real-world environment, but the hit-testing functions remain present for compatibility. With tracked raycasting, ARKit continues to refine the results to increase the position accuracy of virtual content you place with a raycast.

For an example of tracked raycasting, see Placing Objects and Handling 3D Interaction.

Topics

Raycasting

class ARRaycastQuery

A mathematical ray you use to find 3D positions on real-world surfaces.

class ARTrackedRaycast

A raycast query that ARKit repeats in succession to give you refined results over time.

class ARRaycastResult

Information about a real-world surface found by examining a point on the screen.

Hit-Testing

class ARHitTestResult

Information about a real-world surface found by examining a point on the screen.

See Also

Tracking and Interacting with Surfaces

Tracking and Visualizing Planes

Detect surfaces in the physical environment and visualize their shape and location in 3D space.

Visualizing and Interacting with a Reconstructed Scene

Estimate the shape of the physical environment using a polygonal mesh.

class ARPlaneAnchor

A 2D surface that ARKit detects in the physical environment.

class ARMeshAnchor

A section of the reconstructed-scene mesh.