---
title: "trackedRaycast(from:allowing:alignment:updateHandler:)"
framework: realitykit
role: symbol
role_heading: Instance Method
path: "realitykit/arview/trackedraycast(from:allowing:alignment:updatehandler:)"
---

# trackedRaycast(from:allowing:alignment:updateHandler:)

Performs a tracked ray cast, where a ray is cast into the scene from the center of the camera through a point in the view.

## Declaration

```swift
@MainActor @preconcurrency func trackedRaycast(from point: CGPoint, allowing target: ARRaycastQuery.Target, alignment: ARRaycastQuery.TargetAlignment, updateHandler: @escaping ([ARRaycastResult]) -> Void) -> ARTrackedRaycast?
```

## Parameters

- `point`: A point in the view’s local coordinate system.
- `target`: The type of target where the ray should terminate.
- `alignment`: The alignment of the target.
- `updateHandler`: A closure the method calls to update the list of results, sorted from nearest to farthest from the camera. The closure is called on the doc://com.apple.RealityKit/documentation/RealityKit/ARView/session instance’s delegate queue.

## Return Value

Return Value A tracked ray-cast instance used to update or stop ray casting. The result is nil if the ray cast fails or if the AR session configuration isn’t ARWorldTrackingConfiguration or one of its subclasses.

## See Also

### Finding entities at a point in the view

- [entity(at:)](realitykit/arview/entity(at:).md)
- [entities(at:)](realitykit/arview/entities(at:).md)
- [hitTest(_:query:mask:)](realitykit/arview/hittest(_:query:mask:).md)
- [hitTest(_:types:)](realitykit/arview/hittest(_:types:).md)
- [makeRaycastQuery(from:allowing:alignment:)](realitykit/arview/makeraycastquery(from:allowing:alignment:).md)
- [raycast(from:allowing:alignment:)](realitykit/arview/raycast(from:allowing:alignment:).md)
