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.

OpenXRInterface

Hérite de : XRInterface < RefCounted < Object

Notre interface OpenXR.

Description

L'interface OpenXR permet à Godot d'interagir avec OpenXR et de créer des expériences et des jeux XR.

En raison des besoins d'OpenXR, cette interface fonctionne légèrement différent des autres plugins d'interfaces XR. Elle doit être initialisée quand Godot démarre. Vous devez activer OpenXR, les paramètres pour cela peuvent être trouvés dans les paramètres du projet de votre jeu sous la rubrique XR. Vous avez besoin de marquer un viewport pour une utilisation XR afin que Godot sache quel résultat de rendu devrait être envoyé vers le casque.

Tutoriels

Propriétés

float

display_refresh_rate

0.0

bool

foveation_dynamic

false

int

foveation_level

0

bool

foveation_with_subsampled_images

false

float

render_target_size_multiplier

1.0

float

vrs_min_radius

20.0

float

vrs_strength

1.0

Méthodes

Array

get_action_sets() const

Array

get_available_display_refresh_rates() const

Vector3

get_hand_joint_angular_velocity(hand: Hand, joint: HandJoints) const

BitField[HandJointFlags]

get_hand_joint_flags(hand: Hand, joint: HandJoints) const

Vector3

get_hand_joint_linear_velocity(hand: Hand, joint: HandJoints) const

Vector3

get_hand_joint_position(hand: Hand, joint: HandJoints) const

float

get_hand_joint_radius(hand: Hand, joint: HandJoints) const

Quaternion

get_hand_joint_rotation(hand: Hand, joint: HandJoints) const

HandTrackedSource

get_hand_tracking_source(hand: Hand) const

HandMotionRange

get_motion_range(hand: Hand) const

SessionState

get_session_state()

bool

is_action_set_active(name: String) const

bool

is_eye_gaze_interaction_supported()

bool

is_foveation_supported() const

bool

is_hand_interaction_supported() const

bool

is_hand_tracking_supported()

bool

is_user_presence_supported() const

bool

is_user_present() const

void

set_action_set_active(name: String, active: bool)

void

set_cpu_level(level: PerfSettingsLevel)

void

set_gpu_level(level: PerfSettingsLevel)

void

set_motion_range(hand: Hand, motion_range: HandMotionRange)


Signaux

cpu_level_changed(sub_domain: int, from_level: int, to_level: int) 🔗

Informs the device CPU performance level has changed in the specified subdomain.


gpu_level_changed(sub_domain: int, from_level: int, to_level: int) 🔗

Informs the device GPU performance level has changed in the specified subdomain.


instance_exiting() 🔗

Informe que notre instance OpenXR est en train de quitter.


pose_recentered() 🔗

Informs the user queued a recenter of the player position.


refresh_rate_changed(refresh_rate: float) 🔗

Informs the user the HMD refresh rate has changed.

Note: Only emitted if XR runtime supports the refresh rate extension.


session_begun() 🔗

Informs our OpenXR session has been started.


session_focussed() 🔗

Informs our OpenXR session now has focus, for example output is sent to the HMD and we're receiving XR input.


session_loss_pending() 🔗

Informs our OpenXR session is in the process of being lost.


session_stopping() 🔗

Informe que notre session OpenXR s'arrête.


session_synchronized() 🔗

Informe que notre session OpenXR a été synchronisée.


session_visible() 🔗

Informe que notre session OpenXR est maintenant visible, par exemple la sortie est envoyée au HMD mais nous ne recevons pas d'entrée XR.


user_presence_changed(is_user_present: bool) 🔗

Signal emitted when the user presence value changes.

Note: This signal will not be emitted during application startup and application shutdown. Developers should assume user presence is gained on startup and lost on shutdown.


Énumérations

enum SessionState: 🔗

SessionState SESSION_STATE_UNKNOWN = 0

L'état de la session est inconnu, nous n'avons pas encore essayé de configurer OpenXR.

SessionState SESSION_STATE_IDLE = 1

L'état initial après que la session OpenXR soit créée ou après que la session soit détruite.

SessionState SESSION_STATE_READY = 2

OpenXR est prêt à démarrer notre session. session_begun est émis lorsque nous changeons vers cette état.

SessionState SESSION_STATE_SYNCHRONIZED = 3

The application has synched its frame loop with the runtime but we're not rendering anything. session_synchronized is emitted when we change to this state.

SessionState SESSION_STATE_VISIBLE = 4

The application has synched its frame loop with the runtime and we're rendering output to the user, however we receive no user input. session_visible is emitted when we change to this state.

Note: This is the current state just before we get the focused state, whenever the user opens a system menu, switches to another application, or takes off their headset.

SessionState SESSION_STATE_FOCUSED = 5

The application has synched its frame loop with the runtime, we're rendering output to the user and we're receiving XR input. session_focussed is emitted when we change to this state.

Note: This is the state OpenXR will be in when the user can fully interact with your game.

SessionState SESSION_STATE_STOPPING = 6

Notre session est en train d'être arrêtée. session_stopping est émis lorsque nous changeons vers cet état.

SessionState SESSION_STATE_LOSS_PENDING = 7

La session va être perdue. session_loss_pending est émis lorsque nous changeons vers cet état.

SessionState SESSION_STATE_EXITING = 8

The OpenXR instance is about to be destroyed and we're exiting. instance_exiting is emitted when we change to this state.


enum Hand: 🔗

Hand HAND_LEFT = 0

Main gauche.

Hand HAND_RIGHT = 1

Main droite.

Hand HAND_MAX = 2

Valeur maximale pour l'énumération de la main.


enum HandMotionRange: 🔗

HandMotionRange HAND_MOTION_RANGE_UNOBSTRUCTED = 0

Full hand range, if user closes their hands, we make a full fist.

HandMotionRange HAND_MOTION_RANGE_CONFORM_TO_CONTROLLER = 1

Conform to controller, if user closes their hands, the tracked data conforms to the shape of the controller.

HandMotionRange HAND_MOTION_RANGE_MAX = 2

Maximum value for the motion range enum.


enum HandTrackedSource: 🔗

HandTrackedSource HAND_TRACKED_SOURCE_UNKNOWN = 0

La source des données du suivi des mains est inconnue (l'extension est probablement non supportée).

HandTrackedSource HAND_TRACKED_SOURCE_UNOBSTRUCTED = 1

La source des données du suivi des mains est non obstruée, cela signifie qu'une méthode précise de suivi des mains est utilisée, par ex. du suivi des mains optique, des gants de données, etc...

HandTrackedSource HAND_TRACKED_SOURCE_CONTROLLER = 2

La source des données du suivi des mains est un contrôleur, les positions des os sont inférées des entrées du contrôleur.

HandTrackedSource HAND_TRACKED_SOURCE_MAX = 3

Représente la taille de l'énumération HandTrackedSource.


enum HandJoints: 🔗

HandJoints HAND_JOINT_PALM = 0

Articulation de la paume.

HandJoints HAND_JOINT_WRIST = 1

Articulation du poignet.

HandJoints HAND_JOINT_THUMB_METACARPAL = 2

Articulation métacarpienne du pouce.

HandJoints HAND_JOINT_THUMB_PROXIMAL = 3

Articulation proximale du pouce.

HandJoints HAND_JOINT_THUMB_DISTAL = 4

Articulation distale du pouce.

HandJoints HAND_JOINT_THUMB_TIP = 5

Articulation du bout du pouce.

HandJoints HAND_JOINT_INDEX_METACARPAL = 6

Articulation métacarpienne de l'index.

HandJoints HAND_JOINT_INDEX_PROXIMAL = 7

Articulation de la phalange proximale de l'index.

HandJoints HAND_JOINT_INDEX_INTERMEDIATE = 8

Articulation de la phalange intermédiaire de l'index.

HandJoints HAND_JOINT_INDEX_DISTAL = 9

Articulation de la phalange distale de l'index.

HandJoints HAND_JOINT_INDEX_TIP = 10

Articulation du bout de l'index.

HandJoints HAND_JOINT_MIDDLE_METACARPAL = 11

Articulation métacarpale du majeur.

HandJoints HAND_JOINT_MIDDLE_PROXIMAL = 12

Articulation de la phalange proximale du majeur.

HandJoints HAND_JOINT_MIDDLE_INTERMEDIATE = 13

Articulation de la phalange intermédiaire du majeur.

HandJoints HAND_JOINT_MIDDLE_DISTAL = 14

Articulation de la phalange distale du majeur.

HandJoints HAND_JOINT_MIDDLE_TIP = 15

Articulation du bout du majeur.

HandJoints HAND_JOINT_RING_METACARPAL = 16

Articulation métacarpienne de l'annulaire.

HandJoints HAND_JOINT_RING_PROXIMAL = 17

Articulation de la phalange proximale de l'annulaire.

HandJoints HAND_JOINT_RING_INTERMEDIATE = 18

Articulation de la phalange intermédiaire de l'annulaire.

HandJoints HAND_JOINT_RING_DISTAL = 19

Articulation de la phalange distale de l'auriculaire.

HandJoints HAND_JOINT_RING_TIP = 20

Articulation du bout de l'annulaire.

HandJoints HAND_JOINT_LITTLE_METACARPAL = 21

Articulation métacarpienne de l'auriculaire.

HandJoints HAND_JOINT_LITTLE_PROXIMAL = 22

Articulation de la phalange proximale de l'auriculaire.

HandJoints HAND_JOINT_LITTLE_INTERMEDIATE = 23

Articulation de la phalange intermédiaire de l'auriculaire.

HandJoints HAND_JOINT_LITTLE_DISTAL = 24

Articulation de la phalange distale de l'auriculaire.

HandJoints HAND_JOINT_LITTLE_TIP = 25

Articulation du bout de l'auriculaire.

HandJoints HAND_JOINT_MAX = 26

Représente la taille de l'énumération HandJoints.


enum PerfSettingsLevel: 🔗

PerfSettingsLevel PERF_SETTINGS_LEVEL_POWER_SAVINGS = 0

L'application est entrée dans une section non-XR (écran verrouillé / sans mouvement de tête), au cours de laquelle les économies d'énergie doivent être priorisées.

PerfSettingsLevel PERF_SETTINGS_LEVEL_SUSTAINED_LOW = 1

The application has entered a low and stable complexity section, during which reducing power is more important than occasional late rendering frames.

PerfSettingsLevel PERF_SETTINGS_LEVEL_SUSTAINED_HIGH = 2

The application has entered a high or dynamic complexity section, during which the XR Runtime strives for consistent XR compositing and frame rendering within a thermally sustainable range.

PerfSettingsLevel PERF_SETTINGS_LEVEL_BOOST = 3

The application has entered a section with very high complexity, during which the XR Runtime is allowed to step up beyond the thermally sustainable range.


enum PerfSettingsSubDomain: 🔗

PerfSettingsSubDomain PERF_SETTINGS_SUB_DOMAIN_COMPOSITING = 0

The compositing performance within the runtime has reached a new level.

PerfSettingsSubDomain PERF_SETTINGS_SUB_DOMAIN_RENDERING = 1

The application rendering performance has reached a new level.

PerfSettingsSubDomain PERF_SETTINGS_SUB_DOMAIN_THERMAL = 2

The temperature of the device has reached a new level.


enum PerfSettingsNotificationLevel: 🔗

PerfSettingsNotificationLevel PERF_SETTINGS_NOTIF_LEVEL_NORMAL = 0

The sub-domain has reached a level where no further actions other than currently applied are necessary.

PerfSettingsNotificationLevel PERF_SETTINGS_NOTIF_LEVEL_WARNING = 1

The sub-domain has reached an early warning level where the application should start proactive mitigation actions.

PerfSettingsNotificationLevel PERF_SETTINGS_NOTIF_LEVEL_IMPAIRED = 2

The sub-domain has reached a critical level where the application should start drastic mitigation actions.


flags HandJointFlags: 🔗

HandJointFlags HAND_JOINT_NONE = 0

Aucun drapeau n'est défini.

HandJointFlags HAND_JOINT_ORIENTATION_VALID = 1

If set, the orientation data is valid, otherwise, the orientation data is unreliable and should not be used.

HandJointFlags HAND_JOINT_ORIENTATION_TRACKED = 2

If set, the orientation data comes from tracking data, otherwise, the orientation data contains predicted data.

HandJointFlags HAND_JOINT_POSITION_VALID = 4

If set, the positional data is valid, otherwise, the positional data is unreliable and should not be used.

HandJointFlags HAND_JOINT_POSITION_TRACKED = 8

If set, the positional data comes from tracking data, otherwise, the positional data contains predicted data.

HandJointFlags HAND_JOINT_LINEAR_VELOCITY_VALID = 16

Si défini, nos données de vitesse linéaire sont valides, sinon, les données de vitesse linéaire sont peu fiables et ne devraient pas être utilisées.

HandJointFlags HAND_JOINT_ANGULAR_VELOCITY_VALID = 32

Si défini, nos données de vitesse angulaire sont valides, sinon, les données de vitesse angulaire sont peu fiables et ne devraient pas être utilisées.


Descriptions des propriétés

float display_refresh_rate = 0.0 🔗

  • void set_display_refresh_rate(value: float)

  • float get_display_refresh_rate()

The display refresh rate for the current HMD. Only functional if this feature is supported by the OpenXR runtime and after the interface has been initialized.


bool foveation_dynamic = false 🔗

  • void set_foveation_dynamic(value: bool)

  • bool get_foveation_dynamic()

If true, enables dynamic foveation adjustment. The interface must be initialized before this is accessible. If enabled, foveation will automatically be adjusted between low and foveation_level.


int foveation_level = 0 🔗

  • void set_foveation_level(value: int)

  • int get_foveation_level()

The foveation level, from 0 (off) to 3 (high). The interface must be initialized before this is accessible.


bool foveation_with_subsampled_images = false 🔗

  • void set_foveation_with_subsampled_images(value: bool)

  • bool get_foveation_with_subsampled_images()

If true, enables subsampled images with foveation, which can provide a performance boost on Vulkan.


float render_target_size_multiplier = 1.0 🔗

  • void set_render_target_size_multiplier(value: float)

  • float get_render_target_size_multiplier()

The render size multiplier for the current HMD. Must be set before the interface has been initialized.


float vrs_min_radius = 20.0 🔗

  • void set_vrs_min_radius(value: float)

  • float get_vrs_min_radius()

Le rayon minimal autour du point focal où la pleine qualité est garantie si VRS est utilisé en tant que pourcentage de la taille de l'écran.

Note : Moteurs de rendu Mobile et Forward+ seulement. Nécessite Viewport.vrs_mode d'être défini à Viewport.VRS_XR.


float vrs_strength = 1.0 🔗

  • void set_vrs_strength(value: float)

  • float get_vrs_strength()

La force utilisée pour calculer la carte de densité VRS. Plus cette valeur est grande, plus le VRS est notable. Cela améliore la performance au coût de la qualité.

Note : Moteurs de rendu Mobile et Forward+ seulement. Nécessite Viewport.vrs_mode d'être défini à Viewport.VRS_XR.


Descriptions des méthodes

Array get_action_sets() const 🔗

Renvoie une liste d'ensembles d'actions enregistrés avec Godot (chargés à partir de l'action map durant l'exécution).


Array get_available_display_refresh_rates() const 🔗

Returns a list of display refresh rates supported by the current HMD. Only returned if this feature is supported by the OpenXR runtime and after the interface has been initialized.


Vector3 get_hand_joint_angular_velocity(hand: Hand, joint: HandJoints) const 🔗

Obsolète : Use XRHandTracker.get_hand_joint_angular_velocity() obtained from XRServer.get_tracker() instead.

Si le suivi des mains est activé, renvoie la vélocité angulaire d'une articulation (joint) d'une main (hand) comme fourni par OpenXR. Elle est relative à la XROrigin3D !


BitField[HandJointFlags] get_hand_joint_flags(hand: Hand, joint: HandJoints) const 🔗

Obsolète : Use XRHandTracker.get_hand_joint_flags() obtained from XRServer.get_tracker() instead.

Si le suivi des mains est activé, renvoie des drapeaux qui nous informent de la validité des données du suivi.


Vector3 get_hand_joint_linear_velocity(hand: Hand, joint: HandJoints) const 🔗

Obsolète : Use XRHandTracker.get_hand_joint_linear_velocity() obtained from XRServer.get_tracker() instead.

Si le suivi des mains est activé, renvoie la vélocité linéaire d'une articulation (joint) d'une main (hand) comme fourni par OpenXR. Elle est relative à la XROrigin3D sans échelle du monde appliquée !


Vector3 get_hand_joint_position(hand: Hand, joint: HandJoints) const 🔗

Obsolète : Use XRHandTracker.get_hand_joint_transform() obtained from XRServer.get_tracker() instead.

Si le suivi des mains est activé, renvoie la position d'une articulation (joint) d'une main (hand) comme fourni par OpenXR. Elle est relative à la XROrigin3D sans échelle du monde appliquée !


float get_hand_joint_radius(hand: Hand, joint: HandJoints) const 🔗

Obsolète : Use XRHandTracker.get_hand_joint_radius() obtained from XRServer.get_tracker() instead.

Si le suivi des mains est activé, renvoie le rayon d'une articulation (joint) d'une main (hand) comme fourni par OpenXR. Aucune échelle du monde n'est appliquée dessus !


Quaternion get_hand_joint_rotation(hand: Hand, joint: HandJoints) const 🔗

Obsolète : Use XRHandTracker.get_hand_joint_transform() obtained from XRServer.get_tracker() instead.

Si le suivi des mains est activé, renvoie la rotation d'une articulation (joint) d'une main (hand) comme fourni par OpenXR.


HandTrackedSource get_hand_tracking_source(hand: Hand) const 🔗

Obsolète : Use XRHandTracker.hand_tracking_source obtained from XRServer.get_tracker() instead.

Si le suivi des mains est activé et que la source de suivi des mains est supportée, obtient la source des données de suivi des mains pour la main hand.


HandMotionRange get_motion_range(hand: Hand) const 🔗

If handtracking is enabled and motion range is supported, gets the currently configured motion range for hand.


SessionState get_session_state() 🔗

Renvoie l'état actuel de notre session OpenXR.


bool is_action_set_active(name: String) const 🔗

Renvoie true si l'ensemble d'actions donné est actif.


bool is_eye_gaze_interaction_supported() 🔗

Returns the capabilities of the eye gaze interaction extension.

Note: This only returns a valid value after OpenXR has been initialized.


bool is_foveation_supported() const 🔗

Returns true if OpenXR's foveation extension is supported. The interface must be initialized before this returns a valid value.

Note: When using the Vulkan rendering driver, Viewport.vrs_mode must be set to Viewport.VRS_XR to support foveation.


bool is_hand_interaction_supported() const 🔗

Renvoie true si le profil d'interaction de mains d'OpenXR est pris en charge et activé.

Note : Cela ne renvoie qu'une valeur valide qu'après que OpenXR a été initialisé.


bool is_hand_tracking_supported() 🔗

Renvoie true si le suivi de mains d'OpenXR est pris en charge et activé.

Note : Cela ne renvoie qu'une valeur valide qu'après que OpenXR a été initialisé.


bool is_user_presence_supported() const 🔗

Returns true if OpenXR's user presence extension is supported and enabled.

Note: This only returns a valid value after OpenXR has been initialized.


bool is_user_present() const 🔗

Returns true if system has detected the presence of a user in the XR experience.


void set_action_set_active(name: String, active: bool) 🔗

Définit l'ensemble d'actions donné comme actif ou inactif.


void set_cpu_level(level: PerfSettingsLevel) 🔗

Définit le niveau de performance CPU du périphérique OpenXR.


void set_gpu_level(level: PerfSettingsLevel) 🔗

Définit le niveau de performance GPU du périphérique OpenXR.


void set_motion_range(hand: Hand, motion_range: HandMotionRange) 🔗

If handtracking is enabled and motion range is supported, sets the currently configured motion range for hand to motion_range.