Up to date

This page is up to date for Godot 4.2. If you still find outdated information, please open an issue.

XRPositionalTracker

Inherits: RefCounted < Object

A tracked object.

Description

An instance of this object represents a device that is tracked, such as a controller or anchor point. HMDs aren't represented here as they are handled internally.

As controllers are turned on and the XRInterface detects them, instances of this object are automatically added to this list of active tracking objects accessible through the XRServer.

The XRController3D and XRAnchor3D both consume objects of this type and should be used in your project. The positional trackers are just under-the-hood objects that make this all work. These are mostly exposed so that GDExtension-based interfaces can interact with them.

Tutorials

Properties

String

description

""

TrackerHand

hand

0

StringName

name

&"Unknown"

String

profile

""

TrackerType

type

128

Methods

Variant

get_input ( StringName name ) const

XRPose

get_pose ( StringName name ) const

bool

has_pose ( StringName name ) const

void

invalidate_pose ( StringName name )

void

set_input ( StringName name, Variant value )

void

set_pose ( StringName name, Transform3D transform, Vector3 linear_velocity, Vector3 angular_velocity, TrackingConfidence tracking_confidence )


Signals

button_pressed ( String name )

Emitted when a button on this tracker is pressed. Note that many XR runtimes allow other inputs to be mapped to buttons.


button_released ( String name )

Emitted when a button on this tracker is released.


input_float_changed ( String name, float value )

Emitted when a trigger or similar input on this tracker changes value.


input_vector2_changed ( String name, Vector2 vector )

Emitted when a thumbstick or thumbpad on this tracker moves.


pose_changed ( XRPose pose )

Emitted when the state of a pose tracked by this tracker changes.


pose_lost_tracking ( XRPose pose )

Emitted when a pose tracked by this tracker stops getting updated tracking data.


profile_changed ( String role )

Emitted when the profile of our tracker changes.


Enumerations

enum TrackerHand:

TrackerHand TRACKER_HAND_UNKNOWN = 0

The hand this tracker is held in is unknown or not applicable.

TrackerHand TRACKER_HAND_LEFT = 1

This tracker is the left hand controller.

TrackerHand TRACKER_HAND_RIGHT = 2

This tracker is the right hand controller.


Property Descriptions

String description = ""

  • void set_tracker_desc ( String value )

  • String get_tracker_desc ( )

The description of this tracker.


TrackerHand hand = 0