Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
XRPositionalTracker
繼承: XRTracker < RefCounted < Object
被繼承: OpenXRSpatialEntityTracker, XRBodyTracker, XRControllerTracker, XRHandTracker
追蹤對象。
說明
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.
教學
屬性
|
||
|
方法
get_input(name: StringName) const |
|
get_pose(name: StringName) const |
|
has_pose(name: StringName) const |
|
void |
invalidate_pose(name: StringName) |
void |
set_input(name: StringName, value: Variant) |
void |
set_pose(name: StringName, transform: Transform3D, linear_velocity: Vector3, angular_velocity: Vector3, tracking_confidence: TrackingConfidence) |
訊號
button_pressed(action_name: String) 🔗
當該追蹤器上的一個按鈕被按下時發出。請注意,許多 XR 運作時允許將其他輸入對應到按鈕。
button_released(action_name: String) 🔗
當該追蹤器上的一個按鈕被釋放時發出。
input_float_changed(action_name: String, value: float) 🔗
當此追蹤器上的一個觸發器或類似輸入更改值時發出。
input_vector2_changed(action_name: String, vector: Vector2) 🔗
當該追蹤器上的一個拇指杆或拇指板移動時發出。
當被此追蹤器追蹤的一個姿勢狀態發生變化時發出。
pose_lost_tracking(pose: XRPose) 🔗
當被此追蹤器追蹤的一個姿勢狀態發生變化時發出。
profile_changed(role: String) 🔗
當我們的追蹤器的配置發生變化時發出。
列舉
enum TrackerHand: 🔗
TrackerHand TRACKER_HAND_UNKNOWN = 0
手持該追蹤器的手是未知的或不適用的。
TrackerHand TRACKER_HAND_LEFT = 1
此追蹤器是左手控制器。
TrackerHand TRACKER_HAND_RIGHT = 2
此追蹤器是右手控制器。
TrackerHand TRACKER_HAND_MAX = 3
Represents the size of the TrackerHand enum.
屬性說明
TrackerHand hand = 0 🔗
void set_tracker_hand(value: TrackerHand)
TrackerHand get_tracker_hand()
定義此追蹤器與哪只手相關。
與此追蹤器關聯的配置,取決於介面,但將指示被追蹤的控制器型別。
方法說明
Variant get_input(name: StringName) const 🔗
已棄用: Use through XRControllerTracker.
返回此追蹤器的輸入。它可以返回一個布林值、浮點數或 Vector2 值,具體取決於輸入是一個按鈕、觸發器還是拇指杆/拇指板。
XRPose get_pose(name: StringName) const 🔗
返回綁定 name 姿勢的目前 XRPose 狀態物件。
bool has_pose(name: StringName) const 🔗
如果追蹤器可用,並且目前正在追蹤綁定的 name 姿勢,則返回 true。
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 an 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 an XRInterface implementation and should not be used directly.