Documentation
¶
Overview ¶
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.
Index ¶
- type Advanced
- type Any
- type Extension
- type Hand
- type HandJointFlags
- type HandJoints
- type HandMotionRange
- type HandTrackedSource
- type ID
- type Instance
- func (self Instance) AsObject() [1]gd.Object
- func (self Instance) AsOpenXRInterface() Instance
- func (self Instance) AsRefCounted() [1]gd.RefCounted
- func (self Instance) AsXRInterface() XRInterface.Instance
- func (self Instance) DisplayRefreshRate() Float.X
- func (self Instance) FoveationDynamic() bool
- func (self Instance) FoveationLevel() int
- func (self Instance) GetActionSets() []OpenXRActionSet.Instance
- func (self Instance) GetAvailableDisplayRefreshRates() []float32
- func (self Instance) GetHandJointAngularVelocity(hand Hand, joint HandJoints) Vector3.XYZ
- func (self Instance) GetHandJointFlags(hand Hand, joint HandJoints) HandJointFlags
- func (self Instance) GetHandJointLinearVelocity(hand Hand, joint HandJoints) Vector3.XYZ
- func (self Instance) GetHandJointPosition(hand Hand, joint HandJoints) Vector3.XYZ
- func (self Instance) GetHandJointRadius(hand Hand, joint HandJoints) Float.X
- func (self Instance) GetHandJointRotation(hand Hand, joint HandJoints) Quaternion.IJKX
- func (self Instance) GetHandTrackingSource(hand Hand) HandTrackedSource
- func (self Instance) GetMotionRange(hand Hand) HandMotionRange
- func (self Instance) GetSessionState() SessionState
- func (self Instance) ID() ID
- func (self Instance) IsActionSetActive(name string) bool
- func (self Instance) IsEyeGazeInteractionSupported() bool
- func (self Instance) IsFoveationSupported() bool
- func (self Instance) IsHandInteractionSupported() bool
- func (self Instance) IsHandTrackingSupported() bool
- func (self Instance) OnCpuLevelChanged(cb func(sub_domain int, from_level int, to_level int), flags ...Signal.Flags)
- func (self Instance) OnGpuLevelChanged(cb func(sub_domain int, from_level int, to_level int), flags ...Signal.Flags)
- func (self Instance) OnInstanceExiting(cb func(), flags ...Signal.Flags)
- func (self Instance) OnPoseRecentered(cb func(), flags ...Signal.Flags)
- func (self Instance) OnRefreshRateChanged(cb func(refresh_rate Float.X), flags ...Signal.Flags)
- func (self Instance) OnSessionBegun(cb func(), flags ...Signal.Flags)
- func (self Instance) OnSessionFocussed(cb func(), flags ...Signal.Flags)
- func (self Instance) OnSessionLossPending(cb func(), flags ...Signal.Flags)
- func (self Instance) OnSessionStopping(cb func(), flags ...Signal.Flags)
- func (self Instance) OnSessionSynchronized(cb func(), flags ...Signal.Flags)
- func (self Instance) OnSessionVisible(cb func(), flags ...Signal.Flags)
- func (self Instance) RenderTargetSizeMultiplier() Float.X
- func (self Instance) SetActionSetActive(name string, active bool)
- func (self Instance) SetCpuLevel(level PerfSettingsLevel)
- func (self Instance) SetDisplayRefreshRate(value Float.X)
- func (self Instance) SetFoveationDynamic(value bool)
- func (self Instance) SetFoveationLevel(value int)
- func (self Instance) SetGpuLevel(level PerfSettingsLevel)
- func (self Instance) SetMotionRange(hand Hand, motion_range HandMotionRange)
- func (self *Instance) SetObject(obj [1]gd.Object) bool
- func (self Instance) SetRenderTargetSizeMultiplier(value Float.X)
- func (self Instance) SetVrsMinRadius(value Float.X)
- func (self Instance) SetVrsStrength(value Float.X)
- func (self Instance) Virtual(name string) reflect.Value
- func (self Instance) VrsMinRadius() Float.X
- func (self Instance) VrsStrength() Float.X
- type PerfSettingsLevel
- type PerfSettingsNotificationLevel
- type PerfSettingsSubDomain
- type SessionState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Advanced ¶
type Advanced = class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
type Extension ¶
Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension
func (*Extension[T]) AsOpenXRInterface ¶
func (*Extension[T]) AsRefCounted ¶
func (self *Extension[T]) AsRefCounted() [1]gd.RefCounted
func (*Extension[T]) AsXRInterface ¶
func (self *Extension[T]) AsXRInterface() XRInterface.Instance
type HandJointFlags ¶
type HandJointFlags int //gd:OpenXRInterface.HandJointFlags
const ( // No flags are set. HandJointNone HandJointFlags = 0 // If set, the orientation data is valid, otherwise, the orientation data is unreliable and should not be used. HandJointOrientationValid HandJointFlags = 1 // If set, the orientation data comes from tracking data, otherwise, the orientation data contains predicted data. HandJointOrientationTracked HandJointFlags = 2 // If set, the positional data is valid, otherwise, the positional data is unreliable and should not be used. HandJointPositionValid HandJointFlags = 4 // If set, the positional data comes from tracking data, otherwise, the positional data contains predicted data. HandJointPositionTracked HandJointFlags = 8 // If set, our linear velocity data is valid, otherwise, the linear velocity data is unreliable and should not be used. HandJointLinearVelocityValid HandJointFlags = 16 // If set, our angular velocity data is valid, otherwise, the angular velocity data is unreliable and should not be used. HandJointAngularVelocityValid HandJointFlags = 32 )
type HandJoints ¶
type HandJoints int //gd:OpenXRInterface.HandJoints
const ( // Palm joint. HandJointPalm HandJoints = 0 // Wrist joint. HandJointWrist HandJoints = 1 // Thumb metacarpal joint. HandJointThumbMetacarpal HandJoints = 2 // Thumb proximal joint. HandJointThumbProximal HandJoints = 3 // Thumb distal joint. HandJointThumbDistal HandJoints = 4 // Thumb tip joint. HandJointThumbTip HandJoints = 5 // Index finger metacarpal joint. HandJointIndexMetacarpal HandJoints = 6 // Index finger phalanx proximal joint. HandJointIndexProximal HandJoints = 7 // Index finger phalanx intermediate joint. HandJointIndexIntermediate HandJoints = 8 // Index finger phalanx distal joint. HandJointIndexDistal HandJoints = 9 // Index finger tip joint. HandJointIndexTip HandJoints = 10 // Middle finger metacarpal joint. HandJointMiddleMetacarpal HandJoints = 11 // Middle finger phalanx proximal joint. HandJointMiddleProximal HandJoints = 12 // Middle finger phalanx intermediate joint. HandJointMiddleIntermediate HandJoints = 13 // Middle finger phalanx distal joint. HandJointMiddleDistal HandJoints = 14 // Middle finger tip joint. HandJointMiddleTip HandJoints = 15 // Ring finger metacarpal joint. HandJointRingMetacarpal HandJoints = 16 // Ring finger phalanx proximal joint. HandJointRingProximal HandJoints = 17 // Ring finger phalanx intermediate joint. HandJointRingIntermediate HandJoints = 18 // Ring finger phalanx distal joint. HandJointRingDistal HandJoints = 19 // Ring finger tip joint. HandJointRingTip HandJoints = 20 // Pinky finger metacarpal joint. HandJointLittleMetacarpal HandJoints = 21 // Pinky finger phalanx proximal joint. HandJointLittleProximal HandJoints = 22 // Pinky finger phalanx intermediate joint. HandJointLittleIntermediate HandJoints = 23 // Pinky finger phalanx distal joint. HandJointLittleDistal HandJoints = 24 // Pinky finger tip joint. HandJointLittleTip HandJoints = 25 // Represents the size of the [HandJoints] enum. HandJointMax HandJoints = 26 )
type HandMotionRange ¶
type HandMotionRange int //gd:OpenXRInterface.HandMotionRange
const ( // Full hand range, if user closes their hands, we make a full fist. HandMotionRangeUnobstructed HandMotionRange = 0 // Conform to controller, if user closes their hands, the tracked data conforms to the shape of the controller. HandMotionRangeConformToController HandMotionRange = 1 // Maximum value for the motion range enum. HandMotionRangeMax HandMotionRange = 2 )
type HandTrackedSource ¶
type HandTrackedSource int //gd:OpenXRInterface.HandTrackedSource
const ( // The source of hand tracking data is unknown (the extension is likely unsupported). HandTrackedSourceUnknown HandTrackedSource = 0 // 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. HandTrackedSourceUnobstructed HandTrackedSource = 1 // The source of hand tracking is a controller, bone positions are inferred from controller inputs. HandTrackedSourceController HandTrackedSource = 2 // Represents the size of the [HandTrackedSource] enum. HandTrackedSourceMax HandTrackedSource = 3 )
type ID ¶
ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.
type Instance ¶
type Instance [1]gdclass.OpenXRInterface
Instance of the class with convieniently typed arguments and results.
var Nil Instance
Nil is a nil/null instance of the class. Equivalent to the zero value.
func (Instance) AsOpenXRInterface ¶
func (Instance) AsRefCounted ¶
func (self Instance) AsRefCounted() [1]gd.RefCounted
func (Instance) AsXRInterface ¶
func (self Instance) AsXRInterface() XRInterface.Instance
func (Instance) DisplayRefreshRate ¶
func (Instance) FoveationDynamic ¶
func (Instance) FoveationLevel ¶
func (Instance) GetActionSets ¶
func (self Instance) GetActionSets() []OpenXRActionSet.Instance
Returns a list of action sets registered with Godot (loaded from the action map at runtime).
func (Instance) 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.
func (Instance) GetHandJointAngularVelocity ¶
func (self Instance) GetHandJointAngularVelocity(hand Hand, joint HandJoints) Vector3.XYZ
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!
func (Instance) GetHandJointFlags ¶
func (self Instance) GetHandJointFlags(hand Hand, joint HandJoints) HandJointFlags
If handtracking is enabled, returns flags that inform us of the validity of the tracking data.
func (Instance) GetHandJointLinearVelocity ¶
func (self Instance) GetHandJointLinearVelocity(hand Hand, joint HandJoints) Vector3.XYZ
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!
func (Instance) GetHandJointPosition ¶
func (self Instance) GetHandJointPosition(hand Hand, joint HandJoints) Vector3.XYZ
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!
func (Instance) GetHandJointRadius ¶
func (self Instance) GetHandJointRadius(hand Hand, joint HandJoints) Float.X
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 (Instance) GetHandJointRotation ¶
func (self Instance) GetHandJointRotation(hand Hand, joint HandJoints) Quaternion.IJKX
If handtracking is enabled, returns the rotation of a joint ('joint') of a hand ('hand') as provided by OpenXR.
func (Instance) GetHandTrackingSource ¶
func (self Instance) GetHandTrackingSource(hand Hand) HandTrackedSource
If handtracking is enabled and hand tracking source is supported, gets the source of the hand tracking data for 'hand'.
func (Instance) GetMotionRange ¶
func (self Instance) GetMotionRange(hand Hand) HandMotionRange
If handtracking is enabled and motion range is supported, gets the currently configured motion range for 'hand'.
func (Instance) GetSessionState ¶
func (self Instance) GetSessionState() SessionState
Returns the current state of our OpenXR session.
func (Instance) IsActionSetActive ¶
Returns true if the given action set is active.
func (Instance) IsEyeGazeInteractionSupported ¶
Returns the capabilities of the eye gaze interaction extension.
Note: This only returns a valid value after OpenXR has been initialized.
func (Instance) 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 Viewport.VrsMode to VRS_XR on desktop.
func (Instance) 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.
func (Instance) IsHandTrackingSupported ¶
Returns true if OpenXR's hand tracking is supported and enabled.
Note: This only returns a valid value after OpenXR has been initialized.
func (Instance) OnCpuLevelChanged ¶
func (Instance) OnGpuLevelChanged ¶
func (Instance) OnInstanceExiting ¶
func (Instance) OnPoseRecentered ¶
func (Instance) OnRefreshRateChanged ¶
func (Instance) OnSessionBegun ¶
func (Instance) OnSessionFocussed ¶
func (Instance) OnSessionLossPending ¶
func (Instance) OnSessionStopping ¶
func (Instance) OnSessionSynchronized ¶
func (Instance) OnSessionVisible ¶
func (Instance) RenderTargetSizeMultiplier ¶
func (Instance) SetActionSetActive ¶
Sets the given action set as active or inactive.
func (Instance) SetCpuLevel ¶
func (self Instance) SetCpuLevel(level PerfSettingsLevel)
Sets the CPU performance level of the OpenXR device.
func (Instance) SetDisplayRefreshRate ¶
func (Instance) SetFoveationDynamic ¶
func (Instance) SetFoveationLevel ¶
func (Instance) SetGpuLevel ¶
func (self Instance) SetGpuLevel(level PerfSettingsLevel)
Sets the GPU performance level of the OpenXR device.
func (Instance) SetMotionRange ¶
func (self Instance) SetMotionRange(hand Hand, motion_range HandMotionRange)
If handtracking is enabled and motion range is supported, sets the currently configured motion range for 'hand' to 'motion_range'.
func (Instance) SetRenderTargetSizeMultiplier ¶
func (Instance) SetVrsMinRadius ¶
func (Instance) SetVrsStrength ¶
func (Instance) VrsMinRadius ¶
func (Instance) VrsStrength ¶
type PerfSettingsLevel ¶
type PerfSettingsLevel int //gd:OpenXRInterface.PerfSettingsLevel
const ( // The application has entered a non-XR section (head-locked / static screen), during which power savings are to be prioritized. PerfSettingsLevelPowerSavings PerfSettingsLevel = 0 // The application has entered a low and stable complexity section, during which reducing power is more important than occasional late rendering frames. PerfSettingsLevelSustainedLow PerfSettingsLevel = 1 // The application has entered a high or dynamic complexity section, during which the XR Runtime strives for consistent XR compositing and frame rendering within a thermally sustainable range. PerfSettingsLevelSustainedHigh PerfSettingsLevel = 2 // The application has entered a section with very high complexity, during which the XR Runtime is allowed to step up beyond the thermally sustainable range. PerfSettingsLevelBoost PerfSettingsLevel = 3 )
type PerfSettingsNotificationLevel ¶
type PerfSettingsNotificationLevel int //gd:OpenXRInterface.PerfSettingsNotificationLevel
const ( // The sub-domain has reached a level where no further actions other than currently applied are necessary. PerfSettingsNotifLevelNormal PerfSettingsNotificationLevel = 0 // The sub-domain has reached an early warning level where the application should start proactive mitigation actions. PerfSettingsNotifLevelWarning PerfSettingsNotificationLevel = 1 // The sub-domain has reached a critical level where the application should start drastic mitigation actions. PerfSettingsNotifLevelImpaired PerfSettingsNotificationLevel = 2 )
type PerfSettingsSubDomain ¶
type PerfSettingsSubDomain int //gd:OpenXRInterface.PerfSettingsSubDomain
const ( // The compositing performance within the runtime has reached a new level. PerfSettingsSubDomainCompositing PerfSettingsSubDomain = 0 // The application rendering performance has reached a new level. PerfSettingsSubDomainRendering PerfSettingsSubDomain = 1 // The temperature of the device has reached a new level. PerfSettingsSubDomainThermal PerfSettingsSubDomain = 2 )
type SessionState ¶
type SessionState int //gd:OpenXRInterface.SessionState
const ( // The state of the session is unknown, we haven't tried setting up OpenXR yet. SessionStateUnknown SessionState = 0 // The initial state after the OpenXR session is created or after the session is destroyed. SessionStateIdle SessionState = 1 // OpenXR is ready to begin our session. [OnSessionBegun] is emitted when we change to this state. // // [OnSessionBegun]: https://pkg.go.dev/graphics.gd/classdb/#Instance.OnSessionBegun SessionStateReady SessionState = 2 // The application has synched its frame loop with the runtime but we're not rendering anything. [OnSessionSynchronized] is emitted when we change to this state. // // [OnSessionSynchronized]: https://pkg.go.dev/graphics.gd/classdb/#Instance.OnSessionSynchronized SessionStateSynchronized SessionState = 3 // The application has synched its frame loop with the runtime and we're rendering output to the user, however we receive no user input. [OnSessionVisible] is emitted when we change to this state. // // Note: This is the current state just before we get the focused state, whenever the user opens a system menu, switches to another application, or takes off their headset. // // [OnSessionVisible]: https://pkg.go.dev/graphics.gd/classdb/#Instance.OnSessionVisible SessionStateVisible SessionState = 4 // The application has synched its frame loop with the runtime, we're rendering output to the user and we're receiving XR input. [OnSessionFocussed] is emitted when we change to this state. // // Note: This is the state OpenXR will be in when the user can fully interact with your game. // // [OnSessionFocussed]: https://pkg.go.dev/graphics.gd/classdb/#Instance.OnSessionFocussed SessionStateFocused SessionState = 5 // Our session is being stopped. [OnSessionStopping] is emitted when we change to this state. // // [OnSessionStopping]: https://pkg.go.dev/graphics.gd/classdb/#Instance.OnSessionStopping SessionStateStopping SessionState = 6 // The session is about to be lost. [OnSessionLossPending] is emitted when we change to this state. // // [OnSessionLossPending]: https://pkg.go.dev/graphics.gd/classdb/#Instance.OnSessionLossPending SessionStateLossPending SessionState = 7 // The OpenXR instance is about to be destroyed and we're existing. [OnInstanceExiting] is emitted when we change to this state. // // [OnInstanceExiting]: https://pkg.go.dev/graphics.gd/classdb/#Instance.OnInstanceExiting SessionStateExiting SessionState = 8 )