Class

ARHitTestResult

Information about a real-world surface found by examining a point in the device camera view of an AR session.

Overview

If you display an AR experience using SceneKit or SpriteKit, you can use one of the following methods to search the camera image for real-world content at a point specified in view coordinates:

Otherwise, you can search the camera image for real-world content using the ARFrame hitTest(_:types:) method. Because a frame is independent of a view, for this method you pass a point specified in normalized image coordinates (where (0,0) is the top left corner of the image and (1,1) is the lower right).

All these methods return an array of ARHitTestResult objects describing the content found.

Topics

Identifying Results

var type: ARHitTestResult.ResultType

The kind of detected feature the search result represents.

struct ARHitTestResult.ResultType

Possible types of hit-test searching to perform or type of objects found by a search.

var anchor: ARAnchor?

The anchor representing the detected surface, if any.

Examining Result Geometry

var distance: CGFloat

The distance, in meters, from the camera to the detected surface.

var worldTransform: matrix_float4x4

The position and orientation of the hit test result relative to the world coordinate system.

var localTransform: matrix_float4x4

The position and orientation of the hit test result relative to the nearest anchor or feature point.

Relationships

Inherits From

Conforms To

See Also

Real-World Objects and Positions

class ARAnchor

A real-world position and orientation that can be used for placing objects in an AR scene.

protocol ARTrackable

A real-world object in a scene for which ARKit tracks changes to position and orientation.