---
title: "hitTest(_:query:mask:)"
framework: realitykit
role: symbol
role_heading: Instance Method
path: "realitykit/arview/hittest(_:query:mask:)"
---

# hitTest(_:query:mask:)

Searches for objects corresponding to a point in the view based on a query and a collision mask.

## Declaration

```swift
@MainActor @preconcurrency func hitTest(_ point: CGPoint, query: CollisionCastQueryType = .all, mask: CollisionGroup = .all) -> [CollisionCastHit]
```

## Parameters

- `point`: A point in the view’s coordinate system.
- `query`: The query type.
- `mask`: A collision mask that can be used to prevent hits with certain objects.

## Return Value

Return Value An array of hit results.

## Discussion

Discussion The method ignores entities that lack a CollisionComponent.

## 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(_: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)
- [trackedRaycast(from:allowing:alignment:updateHandler:)](realitykit/arview/trackedraycast(from:allowing:alignment:updatehandler:).md)
