Class

ARRaycastQuery

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

Declaration

@interface ARRaycastQuery : NSObject

Overview

You create a raycast query by providing a 3D vector and starting place.

To create a raycast query using a 2D screen location and default vector that casts outward in the z-direction from the user, use the convenience functions, makeRaycastQuery(from:allowing:alignment:) on ARView, or raycastQueryFromPoint:allowingTarget:alignment: on ARSCNView.

Raycasts can intersect with planes (flat surfaces) or meshes (uneven surfaces). To intersect with planes, see ARRaycastTarget. To intersect with meshes, see ARRaycastTargetEstimatedPlane.

Topics

Creating a Raycast Query

Specifying the Target

target

A plane type that allows the raycast to terminate if it's encountered.

ARRaycastTarget

The types of surface you allow a raycast to intersect with.

targetAlignment

The target's alignment with respect to gravity.

ARRaycastTargetAlignment

A specification that indicates a target's alignment with respect to gravity.

Interpreting the Ray

direction

A vector that describes the ray's trajectory in 3D space.

origin

A 3D coordinate that defines the ray's starting place.

Relationships

Inherits From

See Also

Raycasting

ARTrackedRaycast

A raycast 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.