OpenXRInterface

Inherits:XRInterface<RefCounted<Object

Our OpenXR interface.

Description

The OpenXR interface allows Godot to interact with OpenXR runtimes and make it possible to create XR experiences and games.

Due to the needs of OpenXR this interface works slightly different than other plugin based XR interfaces. It needs to be initialized when Godot starts. You need to enable OpenXR, settings for this can be found in your games project settings under the XR heading. You do need to mark a viewport for use with XR in order for Godot to know which render result should be output to the headset.

Tutorials

Properties

float

display_refresh_rate

0.0

bool

foveation_dynamic

false

int

foveation_level

0

float

render_target_size_multiplier

1.0

float

vrs_min_radius

20.0

float

vrs_strength

1.0

Methods

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

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()

void

set_action_set_active(name:String, active:bool)

void

set_motion_range(hand:Hand, motion_range:HandMotionRange)


Signals

instance_exiting()🔗

Informs our OpenXR instance is exiting.


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.


session_loss_pending()🔗

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


session_stopping()🔗

Informs our OpenXR session is stopping.


session_visible()🔗

Informs our OpenXR session is now visible (output is being sent to the HMD).


Enumerations

enumHand:🔗

HandHAND_LEFT =0

Left hand.

HandHAND_RIGHT =1

Right hand.

HandHAND_MAX =2

Maximum value for the hand enum.


enumHandMotionRange:🔗

HandMotionRangeHAND_MOTION_RANGE_UNOBSTRUCTED =0

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

HandMotionRangeHAND_MOTION_RANGE_CONFORM_TO_CONTROLLER =1

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

HandMotionRangeHAND_MOTION_RANGE_MAX =2

Maximum value for the motion range enum.


enumHandTrackedSource:🔗

HandTrackedSourceHAND_TRACKED_SOURCE_UNKNOWN =0

The source of hand tracking data is unknown (the extension is likely unsupported).

HandTrackedSourceHAND_TRACKED_SOURCE_UNOBSTRUCTED =1

The source of hand tracking is unobstructed, this means that an accurate method of hand tracking is used, e.g. optical hand tracking, data gloves, etc.

HandTrackedSourceHAND_TRACKED_SOURCE_CONTROLLER =2

The source of hand tracking is a controller, bone positions are inferred from controller inputs.

HandTrackedSourceHAND_TRACKED_SOURCE_MAX =3

Maximum value for the hand tracked source enum.


enumHandJoints:🔗

HandJointsHAND_JOINT_PALM =0

Palm joint.

HandJointsHAND_JOINT_WRIST =1

Wrist joint.

HandJointsHAND_JOINT_THUMB_METACARPAL =2

Thumb metacarpal joint.

HandJointsHAND_JOINT_THUMB_PROXIMAL =3

Thumb proximal joint.

HandJointsHAND_JOINT_THUMB_DISTAL =4

Thumb distal joint.

HandJointsHAND_JOINT_THUMB_TIP =5

Thumb tip joint.

HandJointsHAND_JOINT_INDEX_METACARPAL =6

Index metacarpal joint.

HandJointsHAND_JOINT_INDEX_PROXIMAL =7

Index proximal joint.

HandJointsHAND_JOINT_INDEX_INTERMEDIATE =8

Index intermediate joint.

HandJointsHAND_JOINT_INDEX_DISTAL =9

Index distal joint.

HandJointsHAND_JOINT_INDEX_TIP =10

Index tip joint.

HandJointsHAND_JOINT_MIDDLE_METACARPAL =11

Middle metacarpal joint.

HandJointsHAND_JOINT_MIDDLE_PROXIMAL =12

Middle proximal joint.

HandJointsHAND_JOINT_MIDDLE_INTERMEDIATE =13

Middle intermediate joint.

HandJointsHAND_JOINT_MIDDLE_DISTAL =14

Middle distal joint.

HandJointsHAND_JOINT_MIDDLE_TIP =15

Middle tip joint.

HandJointsHAND_JOINT_RING_METACARPAL =16

Ring metacarpal joint.

HandJointsHAND_JOINT_RING_PROXIMAL =17

Ring proximal joint.

HandJointsHAND_JOINT_RING_INTERMEDIATE =18

Ring intermediate joint.

HandJointsHAND_JOINT_RING_DISTAL =19

Ring distal joint.

HandJointsHAND_JOINT_RING_TIP =20

Ring tip joint.

HandJointsHAND_JOINT_LITTLE_METACARPAL =21

Little metacarpal joint.

HandJointsHAND_JOINT_LITTLE_PROXIMAL =22

Little proximal joint.

HandJointsHAND_JOINT_LITTLE_INTERMEDIATE =23

Little intermediate joint.

HandJointsHAND_JOINT_LITTLE_DISTAL =24

Little distal joint.

HandJointsHAND_JOINT_LITTLE_TIP =25

Little tip joint.

HandJointsHAND_JOINT_MAX =26

Maximum value for the hand joint enum.


flagsHandJointFlags:🔗

HandJointFlagsHAND_JOINT_NONE =0

No flags are set.

HandJointFlagsHAND_JOINT_ORIENTATION_VALID =1

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

HandJointFlagsHAND_JOINT_ORIENTATION_TRACKED =2

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

HandJointFlagsHAND_JOINT_POSITION_VALID =4

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

HandJointFlagsHAND_JOINT_POSITION_TRACKED =8

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

HandJointFlagsHAND_JOINT_LINEAR_VELOCITY_VALID =16

If set, our linear velocity data is valid, otherwise, the linear velocity data is unreliable and should not be used.

HandJointFlagsHAND_JOINT_ANGULAR_VELOCITY_VALID =32

If set, our angular velocity data is valid, otherwise, the angular velocity data is unreliable and should not be used.


Property Descriptions

floatdisplay_refresh_rate =0.0🔗

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.


boolfoveation_dynamic =false🔗

Enable dynamic foveation adjustment, the interface must be initialized before this is accessible. If enabled foveation will automatically adjusted between low andfoveation_level.

Note: Only works on compatibility renderer.


intfoveation_level =0🔗

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

Note: Only works on compatibility renderer.


floatrender_target_size_multiplier =1.0🔗

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


floatvrs_min_radius =20.0🔗

The minimum radius around the focal point where full quality is guaranteed if VRS is used as a percentage of screen size.

Note: Mobile and Forward+ renderers only. RequiresViewport.vrs_mode to be set toViewport.VRS_XR.


floatvrs_strength =1.0🔗

The strength used to calculate the VRS density map. The greater this value, the more noticeable VRS is. This improves performance at the cost of quality.

Note: Mobile and Forward+ renderers only. RequiresViewport.vrs_mode to be set toViewport.VRS_XR.


Method Descriptions

Arrayget_action_sets()const🔗

Returns a list of action sets registered with Godot (loaded from the action map at runtime).


Arrayget_available_display_refresh_rates()const🔗

Returns 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.


Vector3get_hand_joint_angular_velocity(hand:Hand, joint:HandJoints)const🔗

Deprecated: UseXRHandTracker.get_hand_joint_angular_velocity() obtained fromXRServer.get_tracker() instead.

If handtracking is enabled, returns the angular velocity of a joint (joint) of a hand (hand) as provided by OpenXR. This is relative toXROrigin3D!


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

Deprecated: UseXRHandTracker.get_hand_joint_flags() obtained fromXRServer.get_tracker() instead.

If handtracking is enabled, returns flags that inform us of the validity of the tracking data.


Vector3get_hand_joint_linear_velocity(hand:Hand, joint:HandJoints)const🔗

Deprecated: UseXRHandTracker.get_hand_joint_linear_velocity() obtained fromXRServer.get_tracker() instead.

If handtracking is enabled, returns the linear velocity of a joint (joint) of a hand (hand) as provided by OpenXR. This is relative toXROrigin3D without worldscale applied!


Vector3get_hand_joint_position(hand:Hand, joint:HandJoints)const🔗

Deprecated: UseXRHandTracker.get_hand_joint_transform() obtained fromXRServer.get_tracker() instead.

If handtracking is enabled, returns the position of a joint (joint) of a hand (hand) as provided by OpenXR. This is relative toXROrigin3D without worldscale applied!


floatget_hand_joint_radius(hand:Hand, joint:HandJoints)const🔗

Deprecated: UseXRHandTracker.get_hand_joint_radius() obtained fromXRServer.get_tracker() instead.

If handtracking is enabled, returns the radius of a joint (joint) of a hand (hand) as provided by OpenXR. This is without worldscale applied!


Quaternionget_hand_joint_rotation(hand:Hand, joint:HandJoints)const🔗

Deprecated: UseXRHandTracker.get_hand_joint_transform() obtained fromXRServer.get_tracker() instead.

If handtracking is enabled, returns the rotation of a joint (joint) of a hand (hand) as provided by OpenXR.


HandTrackedSourceget_hand_tracking_source(hand:Hand)const🔗

Deprecated: UseXRHandTracker.hand_tracking_source obtained fromXRServer.get_tracker() instead.

If handtracking is enabled and hand tracking source is supported, gets the source of the hand tracking data forhand.


HandMotionRangeget_motion_range(hand:Hand)const🔗

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


boolis_action_set_active(name:String)const🔗

Returnstrue if the given action set is active.


boolis_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.


boolis_foveation_supported()const🔗

Returnstrue if OpenXR's foveation extension is supported, the interface must be initialized before this returns a valid value.

Note: This feature is only available on the compatibility renderer and currently only available on some stand alone headsets. For Vulkan setViewport.vrs_mode toVRS_XR on desktop.


boolis_hand_interaction_supported()const🔗

Returnstrue if OpenXR's hand interaction profile is supported and enabled.

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


boolis_hand_tracking_supported()🔗

Returnstrue if OpenXR's hand tracking is supported and enabled.

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


voidset_action_set_active(name:String, active:bool)🔗

Sets the given action set as active or inactive.


voidset_motion_range(hand:Hand, motion_range:HandMotionRange)🔗

If handtracking is enabled and motion range is supported, sets the currently configured motion range forhand tomotion_range.


User-contributed notes

Please read theUser-contributed notes policy before submitting a comment.