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
FoveationDynamic
Enable dynamic foveation adjustment, the interface must be initialized before this is accessible. If enabled foveation will automatically adjusted between low and FoveationLevel.
Note: Only works on compatibility renderer.
public bool FoveationDynamic { get; set; }
Property Value
FoveationLevel
Set foveation level from 0 (off) to 3 (high), the interface must be initialized before this is accessible.
Note: Only works on compatibility renderer.
public int FoveationLevel { get; set; }
Property Value
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
VrsMinRadius
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 VrsMode to be set to XR.
public float VrsMinRadius { get; set; }
Property Value
VrsStrength
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 VrsMode to be set to XR.
public float VrsStrength { get; set; }
Property Value
Methods
GetActionSets()
Returns a list of action sets registered with Godot (loaded from the action map at runtime).
public Array GetActionSets()
Returns
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
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!
[Obsolete("Use 'Godot.XRHandTracker.GetHandJointAngularVelocity(XRHandTracker.HandJoint)' obtained from 'Godot.XRServer.GetTracker(StringName)' instead.")]
public Vector3 GetHandJointAngularVelocity(OpenXRInterface.Hand hand, OpenXRInterface.HandJoints joint)
Parameters
hand
OpenXRInterface.Handjoint
OpenXRInterface.HandJoints
Returns
GetHandJointFlags(Hand, HandJoints)
If handtracking is enabled, returns flags that inform us of the validity of the tracking data.
[Obsolete("Use 'Godot.XRHandTracker.GetHandJointFlags(XRHandTracker.HandJoint)' obtained from 'Godot.XRServer.GetTracker(StringName)' instead.")]
public OpenXRInterface.HandJointFlags GetHandJointFlags(OpenXRInterface.Hand hand, OpenXRInterface.HandJoints joint)
Parameters
hand
OpenXRInterface.Handjoint
OpenXRInterface.HandJoints
Returns
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!
[Obsolete("Use 'Godot.XRHandTracker.GetHandJointLinearVelocity(XRHandTracker.HandJoint)' obtained from 'Godot.XRServer.GetTracker(StringName)' instead.")]
public Vector3 GetHandJointLinearVelocity(OpenXRInterface.Hand hand, OpenXRInterface.HandJoints joint)
Parameters
hand
OpenXRInterface.Handjoint
OpenXRInterface.HandJoints
Returns
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!
[Obsolete("Use 'Godot.XRHandTracker.GetHandJointTransform(XRHandTracker.HandJoint)' obtained from 'Godot.XRServer.GetTracker(StringName)' instead.")]
public Vector3 GetHandJointPosition(OpenXRInterface.Hand hand, OpenXRInterface.HandJoints joint)
Parameters
hand
OpenXRInterface.Handjoint
OpenXRInterface.HandJoints
Returns
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!
[Obsolete("Use 'Godot.XRHandTracker.GetHandJointRadius(XRHandTracker.HandJoint)' obtained from 'Godot.XRServer.GetTracker(StringName)' instead.")]
public float GetHandJointRadius(OpenXRInterface.Hand hand, OpenXRInterface.HandJoints joint)
Parameters
hand
OpenXRInterface.Handjoint
OpenXRInterface.HandJoints
Returns
GetHandJointRotation(Hand, HandJoints)
If handtracking is enabled, returns the rotation of a joint (joint
) of a hand (hand
) as provided by OpenXR.
[Obsolete("Use 'Godot.XRHandTracker.GetHandJointTransform(XRHandTracker.HandJoint)' obtained from 'Godot.XRServer.GetTracker(StringName)' instead.")]
public Quaternion GetHandJointRotation(OpenXRInterface.Hand hand, OpenXRInterface.HandJoints joint)
Parameters
hand
OpenXRInterface.Handjoint
OpenXRInterface.HandJoints
Returns
GetHandTrackingSource(Hand)
If handtracking is enabled and hand tracking source is supported, gets the source of the hand tracking data for hand
.
[Obsolete("Use 'Godot.XRHandTracker.HandTrackingSource' obtained from 'Godot.XRServer.GetTracker(StringName)' instead.")]
public OpenXRInterface.HandTrackedSource GetHandTrackingSource(OpenXRInterface.Hand hand)
Parameters
hand
OpenXRInterface.Hand
Returns
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
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_nameName of the method to check for.
Returns
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_nameName of the signal to check for.
Returns
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_nameName of the method to invoke.
args
NativeVariantPtrArgsArguments to use with the invoked method.
ret
godot_variantValue returned by the invoked method.
Returns
IsActionSetActive(string)
Returns true if the given action set is active.
public bool IsActionSetActive(string name)
Parameters
name
string
Returns
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
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
IsHandInteractionSupported()
Returns true if OpenXR's hand interaction profile is supported and enabled.
Note: This only returns a valid value after OpenXR has been initialized.
public bool IsHandInteractionSupported()
Returns
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
SetActionSetActive(string, bool)
Sets the given action set as active or inactive.
public void SetActionSetActive(string name, bool active)
Parameters
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.HandmotionRange
OpenXRInterface.HandMotionRange
Events
InstanceExiting
Informs our OpenXR instance is exiting.
public event Action InstanceExiting
Event Type
PoseRecentered
Informs the user queued a recenter of the player position.
public event Action PoseRecentered
Event Type
RefreshRateChanged
Informs the user the HMD refresh rate has changed.
Note: Only emitted if XR runtime supports the refresh rate extension.
public event OpenXRInterface.RefreshRateChangedEventHandler RefreshRateChanged
Event Type
SessionBegun
Informs our OpenXR session has been started.
public event Action SessionBegun
Event Type
SessionFocussed
Informs our OpenXR session now has focus.
public event Action SessionFocussed
Event Type
SessionLossPending
Informs our OpenXR session is in the process of being lost.
public event Action SessionLossPending
Event Type
SessionStopping
Informs our OpenXR session is stopping.
public event Action SessionStopping
Event Type
SessionVisible
Informs our OpenXR session is now visible (output is being sent to the HMD).
public event Action SessionVisible