XRPositionalTracker

继承: XRTracker < RefCounted < Object

派生: XRBodyTracker, XRControllerTracker, XRHandTracker

A tracked object.

描述

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.

属性

方法

Variantget_input ( name: StringName ) const1
XRPoseget_pose ( name: StringName ) const1
boolhas_pose ( name: StringName ) const1
voidinvalidate_pose ( name: StringName )
voidset_input ( name: StringName, value: Variant )
voidset_pose ( name: StringName, transform: Transform3D, linear_velocity: Vector3, angular_velocity: Vector3, tracking_confidence: TrackingConfidence )

信号

button_pressed ( name: String )

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


button_released ( name: String )

Emitted when a button on this tracker is released.


input_float_changed ( name: String, value: float )

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


input_vector2_changed ( name: String, vector: Vector2 )

Emitted when a thumbstick or thumbpad on this tracker moves.


pose_changed ( pose: XRPose )

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


pose_lost_tracking ( pose: XRPose )

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


profile_changed ( role: String )

Emitted when the profile of our tracker changes.


枚举

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.

TrackerHand TRACKER_HAND_MAX = 3

Represents the size of the TrackerHand enum.


属性说明

TrackerHand hand = 0

Defines which hand this tracker relates to.


String profile = ""

  • void set_tracker_profile ( value: String )
  • String get_tracker_profile ( )

The profile associated with this tracker, interface dependent but will indicate the type of controller being tracked.


方法说明

Variant get_input ( name: StringName ) const1

已弃用: Use through XRControllerTracker.

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.


XRPose get_pose ( name: StringName ) const1

Returns the current XRPose state object for the bound name pose.


bool has_pose ( name: StringName ) const1

Returns true if the tracker is available and is currently tracking the bound name pose.


void invalidate_pose ( name: 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 set_input ( name: StringName, value: Variant )

已弃用: Use through XRControllerTracker.

Changes the value for the given input. This method is called by a XRInterface implementation and should not be used directly.


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

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.

2

本方法通常需要用户覆盖才能生效。

1

本方法无副作用,不会修改该实例的任何成员变量。

3

本方法除了能接受在此处描述的参数外,还能够继续接受任意数量的参数。

4

本方法用于构造某个类型。

5

调用本方法无需实例,可直接使用类名进行调用。

6

本方法描述的是使用本类型作为左操作数的有效运算符。

7

这个值是由下列位标志构成位掩码的整数。

8

无返回值。