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.

XRController3D

Hérite de : XRNode3D < Node3D < Node < Object

Un nœud 3D représentant un contrôleur suivi spatialement.

Description

This is a helper 3D node that is linked to the tracking of controllers. It also offers several handy passthroughs to the state of buttons and such on the controllers.

Controllers are linked by their ID. You can create controller nodes before the controllers are available. If your game always uses two controllers (one for each hand), you can predefine the controllers with ID 1 and 2; they will become active as soon as the controllers are identified. If you expect additional controllers to be used, you should react to the signals and add XRController3D nodes to your scene.

The position of the controller node is automatically updated by the XRServer. This makes this node ideal to add child nodes to visualize the controller.

The current XRInterface defines the names of inputs. In the case of OpenXR, these are the names of actions in the current action set from the OpenXR action map.

Tutoriels

Méthodes

float

get_float(name: StringName) const

Variant

get_input(name: StringName) const

TrackerHand

get_tracker_hand() const

Vector2

get_vector2(name: StringName) const

bool

is_button_pressed(name: StringName) const


Signaux

button_pressed(action_name: String) 🔗

Émis lorsqu’un bouton de ce contrôleur est appuyé.


button_released(action_name: String) 🔗

Émis lorsqu'un bouton de ce contrôleur est relâché.


input_float_changed(action_name: String, value: float) 🔗

Émis lorsqu'une gâchette ou une entrée similaire sur ce contrôleur modifie la valeur.


input_vector2_changed(action_name: String, value: Vector2) 🔗

Emitted when a thumbstick or thumbpad on this controller is moved.


profile_changed(role: String) 🔗

Émis lorsque le profil d'interaction sur ce contrôleur est modifié.


Descriptions des méthodes

float get_float(name: StringName) const 🔗

Renvoie une valeur numérique pour l'entrée avec le nom name donné. Ceci est utilisé pour les gâchettes et les capteurs de préhension.

Note : La XRInterface actuelle définit le nom name pour chaque entrée. Dans le cas d'OpenXR, ce sont les noms des actions dans l'ensemble d'actions actuel.


Variant get_input(name: StringName) const 🔗

Renvoie un Variant pour l'entrée avec le nom name donné. Cela fonctionne pour tout type d'entrée, la variante sera typée selon la configuration des actions.

Note : La XRInterface actuelle définit le nom name pour chaque entrée. Dans le cas d'OpenXR, ce sont les noms des actions dans l'ensemble d'actions actuel.


TrackerHand get_tracker_hand() const 🔗

Renvoie la main tenant ce contrôleur, si connue.


Vector2 get_vector2(name: StringName) const 🔗

Returns a Vector2 for the input with the given name. This is used for thumbsticks and thumbpads found on many controllers.

Note: The current XRInterface defines the name for each input. In the case of OpenXR, these are the names of actions in the current action set.


bool is_button_pressed(name: StringName) const 🔗

Renvoie true si le bouton avec le nom name donné est appuyé.

Note : La XRInterface actuelle définit le nom name pour chaque entrée. Dans le cas d'OpenXR, ce sont les noms des actions dans l'ensemble d'actions actuel.