Table of Contents

Class OpenXRInterface

Our OpenXR interface.

Inheritance
OpenXRInterface

Remarks

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.

See Also

Properties

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.

var display_refresh_rate : float = 0.0

Property Value

float

Remarks

  • void set_display_refresh_rate(float value)
  • float get_display_refresh_rate

foveation_dynamic

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

Note: Only works on compatibility renderer.

var foveation_dynamic : bool = false

Property Value

bool

Remarks

  • void set_foveation_dynamic(bool value)
  • bool get_foveation_dynamic

foveation_level

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

Note: Only works on compatibility renderer.

var foveation_level : int = 0

Property Value

int

Remarks

  • void set_foveation_level(int value)
  • int get_foveation_level

render_target_size_multiplier

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

var render_target_size_multiplier : float = 1.0

Property Value

float

Remarks

  • void set_render_target_size_multiplier(float value)
  • float get_render_target_size_multiplier

vrs_min_radius

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. Requires vrs_mode to be set to Viewport.VRS_XR.

var vrs_min_radius : float = 20.0

Property Value

float

Remarks

  • void set_vrs_min_radius(float value)
  • float get_vrs_min_radius

vrs_strength

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. Requires vrs_mode to be set to Viewport.VRS_XR.

var vrs_strength : float = 1.0

Property Value

float

Remarks

  • void set_vrs_strength(float value)
  • float get_vrs_strength

Methods

get_action_sets

Qualifiers: const

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

Array get_action_sets

get_available_display_refresh_rates

Qualifiers: 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.

Array get_available_display_refresh_rates

get_hand_joint_angular_velocity(int, int)

Qualifiers: const

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

Vector3 get_hand_joint_angular_velocity(int hand, int joint)

Parameters

hand int
joint int

get_hand_joint_flags(int, int)

Qualifiers: const

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

int get_hand_joint_flags(int hand, int joint)

Parameters

hand int
joint int

get_hand_joint_linear_velocity(int, int)

Qualifiers: const

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

Vector3 get_hand_joint_linear_velocity(int hand, int joint)

Parameters

hand int
joint int

get_hand_joint_position(int, int)

Qualifiers: const

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

Vector3 get_hand_joint_position(int hand, int joint)

Parameters

hand int
joint int

get_hand_joint_radius(int, int)

Qualifiers: const

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

float get_hand_joint_radius(int hand, int joint)

Parameters

hand int
joint int

get_hand_joint_rotation(int, int)

Qualifiers: const

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

Quaternion get_hand_joint_rotation(int hand, int joint)

Parameters

hand int
joint int

get_hand_tracking_source(int)

Qualifiers: const

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

int get_hand_tracking_source(int hand)

Parameters

hand int

get_motion_range(int)

Qualifiers: const

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

int get_motion_range(int hand)

Parameters

hand int

is_action_set_active(String)

Qualifiers: const

Returns true if the given action set is active.

bool is_action_set_active(String name)

Parameters

name String

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_eye_gaze_interaction_supported

is_foveation_supported

Qualifiers: const

Returns true 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 set vrs_mode to VRS_XR on desktop.

bool is_foveation_supported

is_hand_interaction_supported

Qualifiers: const

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

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

bool is_hand_interaction_supported

is_hand_tracking_supported

Returns true if OpenXR's hand tracking is supported and enabled.

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

bool is_hand_tracking_supported

set_action_set_active(String, bool)

Sets the given action set as active or inactive.

void set_action_set_active(String name, bool active)

Parameters

name String
active bool

set_motion_range(int, int)

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

void set_motion_range(int hand, int motion_range)

Parameters

hand int
motion_range int

Events

instance_exiting

Informs our OpenXR instance is exiting.

signal instance_exiting

pose_recentered

Informs the user queued a recenter of the player position.

signal pose_recentered

refresh_rate_changed(float)

Informs the user the HMD refresh rate has changed.

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

signal refresh_rate_changed(float refresh_rate)

Parameters

refresh_rate float

session_begun

Informs our OpenXR session has been started.

signal session_begun

session_focussed

Informs our OpenXR session now has focus.

signal session_focussed

session_loss_pending

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

signal session_loss_pending

session_stopping

Informs our OpenXR session is stopping.

signal session_stopping

session_visible

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

signal session_visible