Ray-Casting and Hit-Testing

Find 3D positions on real-world surfaces given a screen point.

Overview

Ray-casting 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 ray-casting, ARKit continues to refine the results to increase the position accuracy of virtual content you place with a ray-cast.

For an example of tracked ray-casting, see Placing Objects and Handling 3D Interaction.

Topics

Ray-Casting

ARRaycastQuery

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

ARTrackedRaycast

A ray-cast query that ARKit repeats in succession to give you refined results over time.

ARRaycastResult

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

Hit-Testing

ARHitTestResult

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

See Also

World Tracking

Understanding World Tracking

Discover supporting concepts, features, and best practices for building great AR experiences.

ARWorldTrackingConfiguration

A configuration that monitors the iOS device's position and orientation while enabling you to augment the environment that's in front of the user.

ARPlaneAnchor

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

Tracking and Visualizing Planes

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

ARCoachingOverlayView

A view that presents visual instructions that guide the user during session initialization and in limited tracking situations.

Placing Objects and Handling 3D Interaction

Place virtual content on real-world surfaces, and enable the user to interact with virtual content by using gestures.

ARWorldMap

The space-mapping state and set of anchors from a world-tracking AR session.

Saving and Loading World Data

Serialize a world tracking session to resume it later on.