Table of Contents

Class OpenXRInterface

Namespace
Godot
Assembly
GodotSharp.dll

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.

public class OpenXRInterface : XRInterface, IDisposable
Inheritance
OpenXRInterface
Implements
Inherited Members

Constructors

OpenXRInterface()

public OpenXRInterface()

Properties

DisplayRefreshRate

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.

public float DisplayRefreshRate { get; set; }

Property Value

float

FoveationDynamic

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

public bool FoveationDynamic { get; set; }

Property Value

bool

FoveationLevel

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

public int FoveationLevel { get; set; }

Property Value

int

RenderTargetSizeMultiplier

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

public double RenderTargetSizeMultiplier { get; set; }

Property Value

double

Methods

GetActionSets()

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

public Array GetActionSets()

Returns

Array

GetAvailableDisplayRefreshRates()

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.

public Array GetAvailableDisplayRefreshRates()

Returns

Array

GetHandJointAngularVelocity(Hand, HandJoints)

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!

public Vector3 GetHandJointAngularVelocity(OpenXRInterface.Hand hand, OpenXRInterface.HandJoints joint)

Parameters

hand OpenXRInterface.Hand
joint OpenXRInterface.HandJoints

Returns

Vector3

GetHandJointFlags(Hand, HandJoints)

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

public OpenXRInterface.HandJointFlags GetHandJointFlags(OpenXRInterface.Hand hand, OpenXRInterface.HandJoints joint)

Parameters

hand OpenXRInterface.Hand
joint OpenXRInterface.HandJoints

Returns

OpenXRInterface.HandJointFlags

GetHandJointLinearVelocity(Hand, HandJoints)

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!

public Vector3 GetHandJointLinearVelocity(OpenXRInterface.Hand hand, OpenXRInterface.HandJoints joint)

Parameters

hand OpenXRInterface.Hand
joint OpenXRInterface.HandJoints

Returns

Vector3

GetHandJointPosition(Hand, HandJoints)

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!

public Vector3 GetHandJointPosition(OpenXRInterface.Hand hand, OpenXRInterface.HandJoints joint)

Parameters

hand OpenXRInterface.Hand
joint OpenXRInterface.HandJoints

Returns

Vector3

GetHandJointRadius(Hand, HandJoints)

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

public float GetHandJointRadius(OpenXRInterface.Hand hand, OpenXRInterface.HandJoints joint)

Parameters

hand OpenXRInterface.Hand
joint OpenXRInterface.HandJoints

Returns

float

GetHandJointRotation(Hand, HandJoints)

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

public Quaternion GetHandJointRotation(OpenXRInterface.Hand hand, OpenXRInterface.HandJoints joint)

Parameters

hand OpenXRInterface.Hand
joint OpenXRInterface.HandJoints

Returns

Quaternion

GetMotionRange(Hand)

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

public OpenXRInterface.HandMotionRange GetMotionRange(OpenXRInterface.Hand hand)

Parameters

hand OpenXRInterface.Hand

Returns

OpenXRInterface.HandMotionRange

HasGodotClassMethod(in godot_string_name)

Check if the type contains a method with the given name. This method is used by Godot to check if a method exists before invoking it. Do not call or override this method.

protected override bool HasGodotClassMethod(in godot_string_name method)

Parameters

method godot_string_name

Name of the method to check for.

Returns

bool

HasGodotClassSignal(in godot_string_name)

Check if the type contains a signal with the given name. This method is used by Godot to check if a signal exists before raising it. Do not call or override this method.

protected override bool HasGodotClassSignal(in godot_string_name signal)

Parameters

signal godot_string_name

Name of the signal to check for.

Returns

bool

InvokeGodotClassMethod(in godot_string_name, NativeVariantPtrArgs, out godot_variant)

Invokes the method with the given name, using the given arguments. This method is used by Godot to invoke methods from the engine side. Do not call or override this method.

protected override bool InvokeGodotClassMethod(in godot_string_name method, NativeVariantPtrArgs args, out godot_variant ret)

Parameters

method godot_string_name

Name of the method to invoke.

args NativeVariantPtrArgs

Arguments to use with the invoked method.

ret godot_variant

Value returned by the invoked method.

Returns

bool

IsActionSetActive(string)

Returns true if the given action set is active.

public bool IsActionSetActive(string name)

Parameters

name string

Returns

bool

IsEyeGazeInteractionSupported()

Returns the capabilities of the eye gaze interaction extension.

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

public bool IsEyeGazeInteractionSupported()

Returns

bool

IsFoveationSupported()

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 VrsMode to VRS_XR on desktop.

public bool IsFoveationSupported()

Returns

bool

IsHandTrackingSupported()

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

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

public bool IsHandTrackingSupported()

Returns

bool

SetActionSetActive(string, bool)

Sets the given action set as active or inactive.

public void SetActionSetActive(string name, bool active)

Parameters

name string
active bool

SetMotionRange(Hand, HandMotionRange)

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

public void SetMotionRange(OpenXRInterface.Hand hand, OpenXRInterface.HandMotionRange motionRange)

Parameters

hand OpenXRInterface.Hand
motionRange OpenXRInterface.HandMotionRange

Events

PoseRecentered

Informs the user queued a recenter of the player position.

public event Action PoseRecentered

Event Type

Action

SessionBegun

Informs our OpenXR session has been started.

public event Action SessionBegun

Event Type

Action

SessionFocussed

Informs our OpenXR session now has focus.

public event Action SessionFocussed

Event Type

Action

SessionStopping

Informs our OpenXR session is stopping.

public event Action SessionStopping

Event Type

Action

SessionVisible

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

public event Action SessionVisible

Event Type

Action