Instance Method

raycast:

Checks once for intersections between a ray and real-world surfaces.

Declaration

- (NSArray<ARRaycastResult *> *)raycast:(ARRaycastQuery *)query;

Parameters

query

The ray you create from a screen point you're interested in.

Return Value

An array of ray-cast results, sorted from nearest to furthest from the camera. The array is empty if the ray cast fails to find an intersection between the query's ray and a real-world surface.

Discussion

Ray casting provides a 3D location in physical space that corresponds to a given 2D location on the screen. When you call this function, it succeeds in returning a result when a mathematical ray that ARKit casts outward from the user intersects with any real-world surfaces that ARKit detects in the physical environment.

See Also

Finding Real-World Surfaces

- trackedRaycast:updateHandler:

Repeats a ray-cast query over time to notify you of updated surfaces in the physical environment.

Beta

Beta Software

This documentation contains preliminary information about an API or technology in development. This information is subject to change, and software implemented according to this documentation should be tested with final operating system software.

Learn more about using Apple's beta software