---
title: "entity(at:in:)"
framework: realitykit
role: symbol
role_heading: Instance Method
path: "realitykit/realitycoordinatespaceprojecting/entity(at:in:)"
---

# entity(at:in:)

Finds the first entity hit when projecting a ray from a starting point.

## Declaration

```swift
func entity(at point: CGPoint, in space: some CoordinateSpaceProtocol) -> Entity?
```

## Parameters

- `point`: A point in the provided coordinate space.
- `space`: The 2D coordinate space in which to interpret the point.

## Return Value

Return Value The entity at point. Returns nil if no entity was found.

## Discussion

Discussion important: RealityKit performs hit tests (ray-casts) against collision shapes. Entities without a valid CollisionComponent are ignored by hit tests.
