<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/ARView/raycast(from:allowing:alignment:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:10RealityKit6ARViewC7raycast4from8allowing9alignmentSaySo15ARRaycastResultCGSo7CGPointV_So0H6TargetVSo0hK9AlignmentVtF"
  },
  "title" : "raycast(from:allowing:alignment:)"
}
-->

# raycast(from:allowing:alignment:)

Performs a ray cast, where a ray is cast into the scene from the center
of the camera through a point in the view, and the results are
immediately returned.

```
@MainActor @preconcurrency func raycast(from point: CGPoint, allowing target: ARRaycastQuery.Target, alignment: ARRaycastQuery.TargetAlignment) -> [ARRaycastResult]
```

## 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.

## Return Value

A list of ray-cast results, sorted from nearest to farthest
from the camera. The list is empty if the ray cast fails.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)