Attention: Here be dragons
This is the latest
(unstable) version of this documentation, which may document features
not available in or compatible with released stable versions of Godot.
Checking the stable version of the documentation...
OpenXRInterface¶
Inherits: XRInterface < RefCounted < Object
Our OpenXR interface.
描述¶
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.
教程¶
属性¶
|
||
|
Methods¶
get_action_sets ( ) const |
|
get_available_display_refresh_rates ( ) const |
|
get_hand_joint_angular_velocity ( Hand hand, HandJoints joint ) const |
|
get_hand_joint_linear_velocity ( Hand hand, HandJoints joint ) const |
|
get_hand_joint_position ( Hand hand, HandJoints joint ) const |
|
get_hand_joint_radius ( Hand hand, HandJoints joint ) const |
|
get_hand_joint_rotation ( Hand hand, HandJoints joint ) const |
|
get_motion_range ( Hand hand ) const |
|
is_action_set_active ( String name ) const |
|
void |
set_action_set_active ( String name, bool active ) |
void |
set_motion_range ( Hand hand, HandMotionRange motion_range ) |
信号¶
pose_recentered ( )
Informs the user queued a recenter of the player position.
session_begun ( )
Informs our OpenXR session has been started.
session_focussed ( )
Informs our OpenXR session now has focus.
session_stopping ( )
Informs our OpenXR session is stopping.
session_visible ( )
Informs our OpenXR session is now visible (output is being sent to the HMD).
Enumerations¶
enum Hand:
Hand HAND_LEFT = 0
Left hand.
Hand HAND_RIGHT = 1
Right hand.
Hand HAND_MAX = 2
Maximum value for the hand enum.
enum HandMotionRange:
HandMotionRange HAND_MOTION_RANGE_UNOBSTRUCTED = 0
HandMotionRange HAND_MOTION_RANGE_CONFORM_TO_CONTROLLER = 1
HandMotionRange HAND_MOTION_RANGE_MAX = 2
enum HandJoints:
HandJoints HAND_JOINT_PALM = 0
Palm joint.
HandJoints HAND_JOINT_WRIST = 1
Wrist joint.
HandJoints HAND_JOINT_THUMB_METACARPAL = 2
Thumb metacarpal joint.
HandJoints HAND_JOINT_THUMB_PROXIMAL = 3
Thumb proximal joint.
HandJoints HAND_JOINT_THUMB_DISTAL = 4
Thumb distal joint.
HandJoints HAND_JOINT_THUMB_TIP = 5
Thumb tip joint.
HandJoints HAND_JOINT_INDEX_METACARPAL = 6
Index metacarpal joint.
HandJoints HAND_JOINT_INDEX_PROXIMAL = 7
Index proximal joint.
HandJoints HAND_JOINT_INDEX_INTERMEDIATE = 8
Index intermediate joint.
HandJoints HAND_JOINT_INDEX_DISTAL = 9
Index distal joint.
HandJoints HAND_JOINT_INDEX_TIP = 10
Index tip joint.
HandJoints HAND_JOINT_MIDDLE_METACARPAL = 11
Middle metacarpal joint.
HandJoints HAND_JOINT_MIDDLE_PROXIMAL = 12
Middle proximal joint.
HandJoints HAND_JOINT_MIDDLE_INTERMEDIATE = 13
Middle intermediate joint.
HandJoints HAND_JOINT_MIDDLE_DISTAL = 14
Middle distal joint.
HandJoints HAND_JOINT_MIDDLE_TIP = 15
Middle tip joint.
HandJoints HAND_JOINT_RING_METACARPAL = 16
Ring metacarpal joint.
HandJoints HAND_JOINT_RING_PROXIMAL = 17
Ring proximal joint.
HandJoints HAND_JOINT_RING_INTERMEDIATE = 18
Ring intermediate joint.
HandJoints HAND_JOINT_RING_DISTAL = 19
Ring distal joint.
HandJoints HAND_JOINT_RING_TIP = 20
Ring tip joint.
HandJoints HAND_JOINT_LITTLE_METACARPAL = 21
Little metacarpal joint.
HandJoints HAND_JOINT_LITTLE_PROXIMAL = 22
Little proximal joint.
HandJoints HAND_JOINT_LITTLE_INTERMEDIATE = 23
Little intermediate joint.
HandJoints HAND_JOINT_LITTLE_DISTAL = 24
Little distal joint.
HandJoints HAND_JOINT_LITTLE_TIP = 25
Little tip joint.
HandJoints HAND_JOINT_MAX = 26
Maximum value for the hand joint enum.
Property Descriptions¶
float display_refresh_rate = 0.0
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.
float render_target_size_multiplier = 1.0
The render size multiplier for the current HMD. Must be set before the interface has been initialized.
Method Descriptions¶
Array get_action_sets ( ) const
Returns a list of action sets registered with Godot (loaded from the action map at runtime).
Array get_available_display_refresh_rates ( ) 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.
Vector3 get_hand_joint_angular_velocity ( Hand hand, HandJoints joint ) 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_linear_velocity ( Hand hand, HandJoints joint ) 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_position ( Hand hand, HandJoints joint ) 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!
float get_hand_joint_radius ( Hand hand, HandJoints joint ) 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!
Quaternion get_hand_joint_rotation ( Hand hand, HandJoints joint ) const
If handtracking is enabled, returns the rotation of a joint (joint
) of a hand (hand
) as provided by OpenXR.
HandMotionRange get_motion_range ( Hand hand ) const
If handtracking is enabled and motion range is supported, gets the currently configured motion range for hand
.
bool is_action_set_active ( String name ) const
Returns true
if the given action set is active.
void set_action_set_active ( String name, bool active )
Sets the given action set as active or inactive.
void set_motion_range ( Hand hand, HandMotionRange motion_range )
If handtracking is enabled and motion range is supported, sets the currently configured motion range for hand
to motion_range
.