---
title: "raycastQuery(from:allowing:alignment:)"
framework: arkit
role: symbol
role_heading: Instance Method
path: "arkit/arscnview/raycastquery(from:allowing:alignment:)"
---

# raycastQuery(from:allowing:alignment:)

Creates a raycast query that originates from a point on the view, aligned with the center of the camera’s field of view.

## Declaration

```swift
func raycastQuery(from point: CGPoint, allowing target: ARRaycastQuery.Target, alignment: ARRaycastQuery.TargetAlignment) -> ARRaycastQuery?
```

## Discussion

Discussion When you call this function, ARKit creates a ray that extends in the positive z-direction from the argument screen space point, to determine if any of the argument targets exist in the physical environment anywhere along the ray. If so, ARKit returns a 3D position where the ray intersects the target.

## See Also

### Finding Real-World Surfaces

- [hitTest(_:types:)](arkit/arscnview/hittest(_:types:).md)
