ARRaycastQuery

Inherits: RefCounted < Object

Defines a raycast query against detected AR surfaces.

Description

Describes the origin, direction, target surface type, and alignment for a raycast. iOS only. On visionOS and macOS, this type exists for API consistency but raycasting is not available through ARKit. On visionOS, use RealityKit scene queries (CollisionComponent) for spatial hit-testing instead.

Properties

Vector3

direction

Vector3(0, 0, 0)

Vector3

origin

Vector3(0, 0, 0)

int

target

1

int

target_alignment

2

Methods

ARRaycastQuery

create(origin: Vector3, direction: Vector3, target: Target, targetAlignment: TargetAlignment) static


Enumerations

enum Target: 🔗

Target EXISTING_PLANE_GEOMETRY = 1

Match against the actual geometry of detected planes.

Target EXISTING_PLANE_INFINITE = 2

Match against infinite extensions of detected planes.

Target ESTIMATED_PLANE = 3

Match against estimated planes inferred from feature points.


enum TargetAlignment: 🔗

TargetAlignment HORIZONTAL = 0

Restrict matches to horizontal surfaces.

TargetAlignment VERTICAL = 1

Restrict matches to vertical surfaces.

TargetAlignment ANY = 2

Allow matches on surfaces of any supported alignment.


Property Descriptions

Vector3 direction = Vector3(0, 0, 0) 🔗

  • void set_direction(value: Vector3)

  • Vector3 get_direction()

The ray direction in world space.


Vector3 origin = Vector3(0, 0, 0) 🔗

  • void set_origin(value: Vector3)

  • Vector3 get_origin()

The ray origin in world space.


int target = 1 🔗

  • void set_target(value: int)

  • int get_target()

The type of surface the raycast should test against. See Target.


int target_alignment = 2 🔗

  • void set_target_alignment(value: int)

  • int get_target_alignment()

The alignment constraint applied to matches. See TargetAlignment.


Method Descriptions

ARRaycastQuery create(origin: Vector3, direction: Vector3, target: Target, targetAlignment: TargetAlignment) static 🔗

Creates a raycast query from origin along direction, using the requested target type and alignment.