Class XRPositionalTracker
A tracked object.
- Inheritance
-
XRPositionalTracker
- Derived
Remarks
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 XRNode3D 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.
See Also
Properties
hand
Defines which hand this tracker relates to.
var hand : int = 0
Property Value
Remarks
profile
The profile associated with this tracker, interface dependent but will indicate the type of controller being tracked.
var profile : String = ""
Property Value
Remarks
Methods
get_input(StringName)
Qualifiers: const
Returns an input for this tracker. It can return a boolean, float or Vector2 value depending on whether the input is a button, trigger or thumbstick/thumbpad.
Variant get_input(StringName name)
Parameters
name
StringName
get_pose(StringName)
Qualifiers: const
Returns the current XRPose state object for the bound name
pose.
XRPose get_pose(StringName name)
Parameters
name
StringName
has_pose(StringName)
Qualifiers: const
Returns true
if the tracker is available and is currently tracking the bound name
pose.
bool has_pose(StringName name)
Parameters
name
StringName
invalidate_pose(StringName)
Marks this pose as invalid, we don't clear the last reported state but it allows users to decide if trackers need to be hidden if we lose tracking or just remain at their last known position.
void invalidate_pose(StringName name)
Parameters
name
StringName
set_input(StringName, Variant)
Changes the value for the given input. This method is called by a XRInterface implementation and should not be used directly.
void set_input(StringName name, Variant value)
Parameters
name
StringNamevalue
Variant
set_pose(StringName, Transform3D, Vector3, Vector3, int)
Sets the transform, linear velocity, angular velocity and tracking confidence for the given pose. This method is called by a XRInterface implementation and should not be used directly.
void set_pose(StringName name, Transform3D transform, Vector3 linear_velocity, Vector3 angular_velocity, int tracking_confidence)
Parameters
name
StringNametransform
Transform3Dlinear_velocity
Vector3angular_velocity
Vector3tracking_confidence
int
Events
button_pressed(String)
Emitted when a button on this tracker is pressed. Note that many XR runtimes allow other inputs to be mapped to buttons.
signal button_pressed(String name)
Parameters
name
String
button_released(String)
Emitted when a button on this tracker is released.
signal button_released(String name)
Parameters
name
String
input_float_changed(String, float)
Emitted when a trigger or similar input on this tracker changes value.
signal input_float_changed(String name, float value)
Parameters
input_vector2_changed(String, Vector2)
Emitted when a thumbstick or thumbpad on this tracker moves.
signal input_vector2_changed(String name, Vector2 vector)
Parameters
pose_changed(XRPose)
Emitted when the state of a pose tracked by this tracker changes.
signal pose_changed(XRPose pose)
Parameters
pose
XRPose
pose_lost_tracking(XRPose)
Emitted when a pose tracked by this tracker stops getting updated tracking data.
signal pose_lost_tracking(XRPose pose)
Parameters
pose
XRPose
profile_changed(String)
Emitted when the profile of our tracker changes.
signal profile_changed(String role)
Parameters
role
String