<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -",
    "macCatalyst: 13.0.0 -",
    "macOS: 10.15.0 -",
    "tvOS: 26.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "RealityKit",
  "identifier" : "/documentation/RealityKit/ARView/ray(through:)",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Method",
  "symbol" : {
    "kind" : "Instance Method",
    "modules" : [
      "RealityKit"
    ],
    "preciseIdentifier" : "s:10RealityKit6ARViewC3ray7throughs5SIMD3VySfG6origin_AH9directiontSgSo7CGPointV_tF"
  },
  "title" : "ray(through:)"
}
-->

# ray(through:)

Determines the position and direction of a ray through the given point
in the 2D space of the view.

```
@MainActor @preconcurrency func ray(through screenPoint: CGPoint) -> (origin: SIMD3<Float>, direction: SIMD3<Float>)?
```

## Parameters

`screenPoint`

A point in the view’s coordinate system.

## Return Value

A tuple that represents a ray in AR coordinates that goes
from the camera origin through the specified point on the screen.

---

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)