OpenXRInterface
Our OpenXR interface.
OpenXRInterface.swift:23class OpenXRInterface
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.
This object emits the following signals:
Superclasses
class XRInterface
Base class for an XR interface implementation.
Citizens in SwiftGodot
Conformances
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol Identifiable<ID>
A class of types whose instances hold the value of an entity with stable identity.
protocol VariantRepresentable
Types that conform to VariantRepresentable can be stored directly in
Variant
with no conversion. These include all of the Variant types from Godot (for exampleGString
,Rect
,Plane
), Godot objects (those that subclass SwiftGodot.Object) as well as the built-in Swift types UInt8, Int64 and Double.protocol VariantStorable
Types that conform to VariantStorable can be stored in a Variant and can be extracted back out of a Variant.
Types
Type members
Instance members
var displayRefreshRate: Double
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 foveationDynamic: Bool
Enable dynamic foveation adjustment, the interface must be initialized before this is accessible. If enabled foveation will automatically adjusted between low and
foveationLevel
.var foveationLevel: Int32
Set foveation level from 0 (off) to 3 (high), the interface must be initialized before this is accessible.
var poseRecentered: SimpleSignal
Informs the user queued a recenter of the player position.
var renderTargetSizeMultiplier: Double
The render size multiplier for the current HMD. Must be set before the interface has been initialized.
var sessionBegun: SimpleSignal
Informs our OpenXR session has been started.
var sessionFocussed: SimpleSignal
Informs our OpenXR session now has focus.
var sessionStopping: SimpleSignal
Informs our OpenXR session is stopping.
var sessionVisible: SimpleSignal
Informs our OpenXR session is now visible (output is being sent to the HMD).
func getActionSets(
) -> GArray Returns a list of action sets registered with Godot (loaded from the action map at runtime).
func getAvailableDisplayRefreshRates(
) -> GArray 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.
func getHandJointAngularVelocity(hand: OpenXRInterface.Hand, joint: OpenXRInterface.HandJoints
) -> Vector3 If handtracking is enabled, returns the angular velocity of a joint (
joint
) of a hand (hand
) as provided by OpenXR. This is relative toXROrigin3D
!func getHandJointFlags(hand: OpenXRInterface.Hand, joint: OpenXRInterface.HandJoints
) -> OpenXRInterface.HandJointFlags If handtracking is enabled, returns flags that inform us of the validity of the tracking data.
func getHandJointLinearVelocity(hand: OpenXRInterface.Hand, joint: OpenXRInterface.HandJoints
) -> Vector3 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!func getHandJointPosition(hand: OpenXRInterface.Hand, joint: OpenXRInterface.HandJoints
) -> Vector3 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!func getHandJointRadius(hand: OpenXRInterface.Hand, joint: OpenXRInterface.HandJoints
) -> Double If handtracking is enabled, returns the radius of a joint (
joint
) of a hand (hand
) as provided by OpenXR. This is without worldscale applied!func getHandJointRotation(hand: OpenXRInterface.Hand, joint: OpenXRInterface.HandJoints
) -> Quaternion If handtracking is enabled, returns the rotation of a joint (
joint
) of a hand (hand
) as provided by OpenXR.func getMotionRange(hand: OpenXRInterface.Hand
) -> OpenXRInterface.HandMotionRange If handtracking is enabled and motion range is supported, gets the currently configured motion range for
hand
.func isActionSetActive(name: String
) -> Bool Returns
true
if the given action set is active.func isEyeGazeInteractionSupported(
) -> Bool Returns the capabilities of the eye gaze interaction extension.
func isFoveationSupported(
) -> Bool Returns
true
if OpenXR’s foveation extension is supported, the interface must be initialized before this returns a valid value.func isHandTrackingSupported(
) -> Bool Returns
true
if OpenXR’s hand tracking is supported and enabled.func setActionSetActive(name: String, active: Bool
) Sets the given action set as active or inactive.
func setMotionRange(hand: OpenXRInterface.Hand, motionRange: OpenXRInterface.HandMotionRange
) If handtracking is enabled and motion range is supported, sets the currently configured motion range for
hand
tomotionRange
.