---
title: ARRaycastQuery
framework: arkit
role: symbol
role_heading: Class
path: arkit/arraycastquery
---

# ARRaycastQuery

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

## Declaration

```swift
class ARRaycastQuery
```

## Overview

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 raycastQuery(from:allowing:alignment:) on ARSCNView. Raycasts can intersect with planes (flat surfaces) or meshes (uneven surfaces). To intersect with planes, see ARRaycastQuery.Target. To intersect with meshes, see ARRaycastQuery.Target.estimatedPlane.

## Topics

### Creating a Raycast Query

- [init(origin:direction:allowing:alignment:)](arkit/arraycastquery/init(origin:direction:allowing:alignment:).md)

### Specifying the Target

- [target](arkit/arraycastquery/target-swift.property.md)
- [ARRaycastQuery.Target](arkit/arraycastquery/target-swift.enum.md)
- [targetAlignment](arkit/arraycastquery/targetalignment-swift.property.md)
- [ARRaycastQuery.TargetAlignment](arkit/arraycastquery/targetalignment-swift.enum.md)

### Interpreting the Ray

- [direction](arkit/arraycastquery/direction.md)
- [origin](arkit/arraycastquery/origin.md)

### Initializers

- [init(origin:direction:allowingTarget:alignment:)](arkit/arraycastquery/init(origin:direction:allowingtarget:alignment:).md)

## Relationships

### Inherits From

- [NSObject](objectivec/nsobject-swift.class.md)

### Conforms To

- [CVarArg](swift/cvararg.md)
- [CustomDebugStringConvertible](swift/customdebugstringconvertible.md)
- [CustomStringConvertible](swift/customstringconvertible.md)
- [Equatable](swift/equatable.md)
- [Hashable](swift/hashable.md)
- [NSObjectProtocol](objectivec/nsobjectprotocol.md)

## See Also

### Raycasting

- [Placing objects and handling 3D interaction](arkit/placing-objects-and-handling-3d-interaction.md)
- [ARTrackedRaycast](arkit/artrackedraycast.md)
- [ARRaycastResult](arkit/arraycastresult.md)
