---
title: "ray(through:)"
framework: realitykit
role: symbol
role_heading: Instance Method
path: "realitykit/arview/ray(through:)"
---

# ray(through:)

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

## Declaration

```swift
@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

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

## See Also

### Mapping between coordinate spaces

- [project(_:)](realitykit/arview/project(_:).md)
- [unproject(_:ontoPlane:relativeToCamera:)](realitykit/arview/unproject(_:ontoplane:relativetocamera:).md)
- [unproject(_:ontoPlane:)](realitykit/arview/unproject(_:ontoplane:).md)
- [unproject(_:viewport:)](realitykit/arview/unproject(_:viewport:).md)
