<!--
{
  "availability" : [
    "iOS: 13.0.0 -",
    "iPadOS: 13.0.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "ARKit",
  "identifier" : "/documentation/ARKit/ARRaycastQuery/init(origin:direction:allowing:alignment:)",
  "metadataVersion" : "0.1.0",
  "role" : "Initializer",
  "symbol" : {
    "kind" : "Initializer",
    "modules" : [
      "ARKit"
    ],
    "preciseIdentifier" : "c:objc(cs)ARRaycastQuery(im)initWithOrigin:direction:allowingTarget:alignment:"
  },
  "title" : "init(origin:direction:allowing:alignment:)"
}
-->

# init(origin:direction:allowing:alignment:)

Creates a new raycast query.

```
init(origin: simd_float3, direction: simd_float3, allowing target: ARRaycastQuery.Target, alignment: ARRaycastQuery.TargetAlignment)
```

## Parameters

`origin`

A 3D position that describes the raycast’s starting point.

`direction`

A 3D vector that describes the raycast’s direction.

`target`

The type of plane with which you allow the raycast to intersect.

`alignment`

The target’s alignment with respect to gravity with which you allow the raycast to intersect.

## Discussion

This creates a query by supplying a 3D starting place and vector. To acquire a raycast query using a screen point and vector that points outward from the user, call [`raycastQuery(from:allowing:alignment:)`](/documentation/ARKit/ARSCNView/raycastQuery(from:allowing:alignment:)) on [`ARSCNView`](/documentation/ARKit/ARSCNView).

---

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)