Class

ARRaycastQuery

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

Declaration

class ARRaycastQuery : NSObject

Overview

You create a ray-cast query by providing a 3D vector and starting place.

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

Topics

Getting the Target

var target: ARRaycastQuery.Target

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

enum ARRaycastQuery.Target

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

var targetAlignment: ARRaycastQuery.TargetAlignment

The target's alignment with respect to gravity.

enum ARRaycastQuery.TargetAlignment

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

Interpreting the Ray

var direction: simd_float3

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

var origin: simd_float3

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

Relationships

Inherits From

Conforms To

See Also

Ray-Casting

class ARTrackedRaycast

A ray-cast 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.