---
title: "hitTest(_:types:)"
framework: arkit
role: symbol
role_heading: Instance Method
path: "arkit/arframe/hittest(_:types:)"
---

# hitTest(_:types:)

Searches for real-world objects or AR anchors in the captured camera image.

## Declaration

```swift
func hitTest(_ point: CGPoint, types: ARHitTestResult.ResultType) -> [ARHitTestResult]
```

## Parameters

- `point`: A point in normalized image coordinate space. (The point (0,0) represents the top left corner of the image, and the point (1,1) represents the bottom right corner.)
- `types`: The types of hit-test result to search for.

## Mentioned in

Displaying an AR Experience with Metal

## Return Value

Return Value A list of results, sorted from nearest to farthest (in distance from the camera).

## Discussion

Discussion Hit testing searches for real-world objects or surfaces detected through the AR session’s processing of the camera image. A 2D point in the image coordinates can refer to any point along a 3D line that starts at the device camera and extends in a direction determined by the device orientation and camera projection. This method searches along that line, returning all objects that intersect it in order of distance from the camera. note: If you use ARKit with a SceneKit or SpriteKit view, the ARSCNView hitTest(_:types:) or ARSKView hitTest(_:types:) method lets you specify a search point in view coordinates. The behavior of a hit test depends on which types you specify and the order you specify them in. For details, see ARHitTestResult and the various ARHitTestResult.ResultType options.

## See Also

### Tracking and interacting with the real world

- [anchors](arkit/arframe/anchors.md)
- [raycastQuery(from:allowing:alignment:)](arkit/arframe/raycastquery(from:allowing:alignment:).md)
