ARRaycastResult

Inherits: RefCounted < Object

Contains the result of an AR raycast, including the hit transform and target surface.

Description

Returned by ARSession.raycast(). Contains the world transform of the hit point, the type of surface hit, and an optional anchor reference. iOS only. On visionOS/macOS this type exists for API consistency but is never populated with real data.

Properties

ARAnchor

anchor

null

int

target

1

int

target_alignment

2

Transform3D

world_transform

Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0)


Enumerations

enum Target: 🔗

Target EXISTING_PLANE_GEOMETRY = 1

The hit came from existing plane geometry.

Target EXISTING_PLANE_INFINITE = 2

The hit came from an infinite extension of an existing plane.

Target ESTIMATED_PLANE = 3

The hit came from an estimated plane.


enum TargetAlignment: 🔗

TargetAlignment HORIZONTAL = 0

The hit surface is horizontally aligned.

TargetAlignment VERTICAL = 1

The hit surface is vertically aligned.

TargetAlignment ANY = 2

The hit surface alignment was not restricted.


Property Descriptions

ARAnchor anchor = null 🔗

The anchor associated with the hit result, if any.


int target = 1 🔗

  • void set_target(value: int)

  • int get_target()

The surface type that was hit. See Target.


int target_alignment = 2 🔗

  • void set_target_alignment(value: int)

  • int get_target_alignment()

The alignment of the matched surface. See TargetAlignment.


Transform3D world_transform = Transform3D(1, 0, 0, 0, 1, 0, 0, 0, 1, 0, 0, 0) 🔗

  • void set_world_transform(value: Transform3D)

  • Transform3D get_world_transform()

The hit transform in world space.