classref: Sync with current master branch (f87858a8f)

This commit is contained in:
Yuri Sizov
2022-12-05 20:38:58 +03:00
parent 913ff5e602
commit a7745c4cc4
843 changed files with 158186 additions and 80821 deletions

View File

@@ -12,7 +12,9 @@ WebXRInterface
**Inherits:** :ref:`XRInterface<class_XRInterface>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
AR/VR interface using WebXR.
XR interface using WebXR.
.. rst-class:: classref-introduction-group
Description
-----------
@@ -23,7 +25,7 @@ As such, this interface is only available when running in Web exports.
WebXR supports a wide range of devices, from the very capable (like Valve Index, HTC Vive, Oculus Rift and Quest) down to the much less capable (like Google Cardboard, Oculus Go, GearVR, or plain smartphones).
Since WebXR is based on JavaScript, it makes extensive use of callbacks, which means that ``WebXRInterface`` is forced to use signals, where other AR/VR interfaces would instead use functions that return a result immediately. This makes ``WebXRInterface`` quite a bit more complicated to initialize than other AR/VR interfaces.
Since WebXR is based on JavaScript, it makes extensive use of callbacks, which means that **WebXRInterface** is forced to use signals, where other XR interfaces would instead use functions that return a result immediately. This makes **WebXRInterface** quite a bit more complicated to initialize than other XR interfaces.
Here's the minimum code required to start an immersive VR session:
@@ -88,7 +90,7 @@ Here's the minimum code required to start an immersive VR session:
func _webxr_session_started():
$Button.visible = false
# This tells Godot to start rendering to the headset.
get_viewport().xr = true
get_viewport().use_xr = true
# This will be the reference space type you ultimately got, out of the
# types that you requested above. This is useful if you want the game to
# work a little differently in 'bounded-floor' versus 'local-floor'.
@@ -98,201 +100,303 @@ Here's the minimum code required to start an immersive VR session:
$Button.visible = true
# If the user exits immersive mode, then we tell Godot to render to the web
# page again.
get_viewport().xr = false
get_viewport().use_xr = false
func _webxr_session_failed(message):
OS.alert("Failed to initialize: " + message)
There are several ways to handle "controller" input:
There are a couple ways to handle "controller" input:
- Using :ref:`XRController3D<class_XRController3D>` nodes and their :ref:`XRController3D.button_pressed<class_XRController3D_signal_button_pressed>` and :ref:`XRController3D.button_released<class_XRController3D_signal_button_released>` signals. This is how controllers are typically handled in AR/VR apps in Godot, however, this will only work with advanced VR controllers like the Oculus Touch or Index controllers, for example. The buttons codes are defined by `Section 3.3 of the WebXR Gamepads Module <https://immersive-web.github.io/webxr-gamepads-module/#xr-standard-gamepad-mapping>`__.
- Using :ref:`XRController3D<class_XRController3D>` nodes and their :ref:`XRController3D.button_pressed<class_XRController3D_signal_button_pressed>` and :ref:`XRController3D.button_released<class_XRController3D_signal_button_released>` signals. This is how controllers are typically handled in XR apps in Godot, however, this will only work with advanced VR controllers like the Oculus Touch or Index controllers, for example.
- Using :ref:`Node._unhandled_input<class_Node_method__unhandled_input>` and :ref:`InputEventJoypadButton<class_InputEventJoypadButton>` or :ref:`InputEventJoypadMotion<class_InputEventJoypadMotion>`. This works the same as normal joypads, except the :ref:`InputEvent.device<class_InputEvent_property_device>` starts at 100, so the left controller is 100 and the right controller is 101, and the button codes are also defined by `Section 3.3 of the WebXR Gamepads Module <https://immersive-web.github.io/webxr-gamepads-module/#xr-standard-gamepad-mapping>`__.
- Using the :ref:`select<class_WebXRInterface_signal_select>`, :ref:`squeeze<class_WebXRInterface_signal_squeeze>` and related signals. This method will work for both advanced VR controllers, and non-traditional input sources like a tap on the screen, a spoken voice command or a button press on the device itself.
- Using the :ref:`select<class_WebXRInterface_signal_select>`, :ref:`squeeze<class_WebXRInterface_signal_squeeze>` and related signals. This method will work for both advanced VR controllers, and non-traditional "controllers" like a tap on the screen, a spoken voice command or a button press on the device itself.
You can use both methods to allow your game or app to support a wider or narrower set of devices and input methods, or to allow more advanced interactions with more advanced devices.
You can use one or all of these methods to allow your game or app to support a wider or narrower set of devices and input methods, or to allow more advanced interactions with more advanced devices.
.. rst-class:: classref-introduction-group
Tutorials
---------
- `How to make a VR game for WebXR with Godot <https://www.snopekgames.com/blog/2020/how-make-vr-game-webxr-godot>`__
.. rst-class:: classref-reftable-group
Properties
----------
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------+
| :ref:`PackedVector3Array<class_PackedVector3Array>` | :ref:`bounds_geometry<class_WebXRInterface_property_bounds_geometry>` |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`optional_features<class_WebXRInterface_property_optional_features>` |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`reference_space_type<class_WebXRInterface_property_reference_space_type>` |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`requested_reference_space_types<class_WebXRInterface_property_requested_reference_space_types>` |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`required_features<class_WebXRInterface_property_required_features>` |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`session_mode<class_WebXRInterface_property_session_mode>` |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`visibility_state<class_WebXRInterface_property_visibility_state>` |
+-----------------------------------------------------+-------------------------------------------------------------------------------------------------------+
.. table::
:widths: auto
+-----------------------------+-------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`optional_features<class_WebXRInterface_property_optional_features>` |
+-----------------------------+-------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`reference_space_type<class_WebXRInterface_property_reference_space_type>` |
+-----------------------------+-------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`requested_reference_space_types<class_WebXRInterface_property_requested_reference_space_types>` |
+-----------------------------+-------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`required_features<class_WebXRInterface_property_required_features>` |
+-----------------------------+-------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`session_mode<class_WebXRInterface_property_session_mode>` |
+-----------------------------+-------------------------------------------------------------------------------------------------------+
| :ref:`String<class_String>` | :ref:`visibility_state<class_WebXRInterface_property_visibility_state>` |
+-----------------------------+-------------------------------------------------------------------------------------------------------+
.. rst-class:: classref-reftable-group
Methods
-------
+-------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`XRPositionalTracker<class_XRPositionalTracker>` | :ref:`get_controller<class_WebXRInterface_method_get_controller>` **(** :ref:`int<class_int>` controller_id **)** |const| |
+-------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`is_session_supported<class_WebXRInterface_method_is_session_supported>` **(** :ref:`String<class_String>` session_mode **)** |
+-------------------------------------------------------+------------------------------------------------------------------------------------------------------------------------------------+
.. table::
:widths: auto
+---------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`TargetRayMode<enum_WebXRInterface_TargetRayMode>` | :ref:`get_input_source_target_ray_mode<class_WebXRInterface_method_get_input_source_target_ray_mode>` **(** :ref:`int<class_int>` input_source_id **)** |const| |
+---------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`XRPositionalTracker<class_XRPositionalTracker>` | :ref:`get_input_source_tracker<class_WebXRInterface_method_get_input_source_tracker>` **(** :ref:`int<class_int>` input_source_id **)** |const| |
+---------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
| :ref:`bool<class_bool>` | :ref:`is_input_source_active<class_WebXRInterface_method_is_input_source_active>` **(** :ref:`int<class_int>` input_source_id **)** |const| |
+---------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
| void | :ref:`is_session_supported<class_WebXRInterface_method_is_session_supported>` **(** :ref:`String<class_String>` session_mode **)** |
+---------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Signals
-------
.. _class_WebXRInterface_signal_reference_space_reset:
- **reference_space_reset** **(** **)**
.. rst-class:: classref-signal
**reference_space_reset** **(** **)**
Emitted to indicate that the reference space has been reset or reconfigured.
When (or whether) this is emitted depends on the user's browser or device, but may include when the user has changed the dimensions of their play space (which you may be able to access via :ref:`bounds_geometry<class_WebXRInterface_property_bounds_geometry>`) or pressed/held a button to recenter their position.
When (or whether) this is emitted depends on the user's browser or device, but may include when the user has changed the dimensions of their play space (which you may be able to access via :ref:`XRInterface.get_play_area<class_XRInterface_method_get_play_area>`) or pressed/held a button to recenter their position.
See `WebXR's XRReferenceSpace reset event <https://developer.mozilla.org/en-US/docs/Web/API/XRReferenceSpace/reset_event>`__ for more information.
.. rst-class:: classref-item-separator
----
.. _class_WebXRInterface_signal_select:
- **select** **(** :ref:`int<class_int>` controller_id **)**
.. rst-class:: classref-signal
Emitted after one of the "controllers" has finished its "primary action".
**select** **(** :ref:`int<class_int>` input_source_id **)**
Use :ref:`get_controller<class_WebXRInterface_method_get_controller>` to get more information about the controller.
Emitted after one of the input sources has finished its "primary action".
Use :ref:`get_input_source_tracker<class_WebXRInterface_method_get_input_source_tracker>` and :ref:`get_input_source_target_ray_mode<class_WebXRInterface_method_get_input_source_target_ray_mode>` to get more information about the input source.
.. rst-class:: classref-item-separator
----
.. _class_WebXRInterface_signal_selectend:
- **selectend** **(** :ref:`int<class_int>` controller_id **)**
.. rst-class:: classref-signal
Emitted when one of the "controllers" has finished its "primary action".
**selectend** **(** :ref:`int<class_int>` input_source_id **)**
Use :ref:`get_controller<class_WebXRInterface_method_get_controller>` to get more information about the controller.
Emitted when one of the input sources has finished its "primary action".
Use :ref:`get_input_source_tracker<class_WebXRInterface_method_get_input_source_tracker>` and :ref:`get_input_source_target_ray_mode<class_WebXRInterface_method_get_input_source_target_ray_mode>` to get more information about the input source.
.. rst-class:: classref-item-separator
----
.. _class_WebXRInterface_signal_selectstart:
- **selectstart** **(** :ref:`int<class_int>` controller_id **)**
.. rst-class:: classref-signal
Emitted when one of the "controllers" has started its "primary action".
**selectstart** **(** :ref:`int<class_int>` input_source_id **)**
Use :ref:`get_controller<class_WebXRInterface_method_get_controller>` to get more information about the controller.
Emitted when one of the input source has started its "primary action".
Use :ref:`get_input_source_tracker<class_WebXRInterface_method_get_input_source_tracker>` and :ref:`get_input_source_target_ray_mode<class_WebXRInterface_method_get_input_source_target_ray_mode>` to get more information about the input source.
.. rst-class:: classref-item-separator
----
.. _class_WebXRInterface_signal_session_ended:
- **session_ended** **(** **)**
.. rst-class:: classref-signal
**session_ended** **(** **)**
Emitted when the user ends the WebXR session (which can be done using UI from the browser or device).
At this point, you should do ``get_viewport().xr = false`` to instruct Godot to resume rendering to the screen.
At this point, you should do ``get_viewport().use_xr = false`` to instruct Godot to resume rendering to the screen.
.. rst-class:: classref-item-separator
----
.. _class_WebXRInterface_signal_session_failed:
- **session_failed** **(** :ref:`String<class_String>` message **)**
.. rst-class:: classref-signal
**session_failed** **(** :ref:`String<class_String>` message **)**
Emitted by :ref:`XRInterface.initialize<class_XRInterface_method_initialize>` if the session fails to start.
\ ``message`` may optionally contain an error message from WebXR, or an empty string if no message is available.
.. rst-class:: classref-item-separator
----
.. _class_WebXRInterface_signal_session_started:
- **session_started** **(** **)**
.. rst-class:: classref-signal
**session_started** **(** **)**
Emitted by :ref:`XRInterface.initialize<class_XRInterface_method_initialize>` if the session is successfully started.
At this point, it's safe to do ``get_viewport().xr = true`` to instruct Godot to start rendering to the AR/VR device.
At this point, it's safe to do ``get_viewport().use_xr = true`` to instruct Godot to start rendering to the XR device.
.. rst-class:: classref-item-separator
----
.. _class_WebXRInterface_signal_session_supported:
- **session_supported** **(** :ref:`String<class_String>` session_mode, :ref:`bool<class_bool>` supported **)**
.. rst-class:: classref-signal
**session_supported** **(** :ref:`String<class_String>` session_mode, :ref:`bool<class_bool>` supported **)**
Emitted by :ref:`is_session_supported<class_WebXRInterface_method_is_session_supported>` to indicate if the given ``session_mode`` is supported or not.
.. rst-class:: classref-item-separator
----
.. _class_WebXRInterface_signal_squeeze:
- **squeeze** **(** :ref:`int<class_int>` controller_id **)**
.. rst-class:: classref-signal
Emitted after one of the "controllers" has finished its "primary squeeze action".
**squeeze** **(** :ref:`int<class_int>` input_source_id **)**
Use :ref:`get_controller<class_WebXRInterface_method_get_controller>` to get more information about the controller.
Emitted after one of the input sources has finished its "primary squeeze action".
Use :ref:`get_input_source_tracker<class_WebXRInterface_method_get_input_source_tracker>` and :ref:`get_input_source_target_ray_mode<class_WebXRInterface_method_get_input_source_target_ray_mode>` to get more information about the input source.
.. rst-class:: classref-item-separator
----
.. _class_WebXRInterface_signal_squeezeend:
- **squeezeend** **(** :ref:`int<class_int>` controller_id **)**
.. rst-class:: classref-signal
Emitted when one of the "controllers" has finished its "primary squeeze action".
**squeezeend** **(** :ref:`int<class_int>` input_source_id **)**
Use :ref:`get_controller<class_WebXRInterface_method_get_controller>` to get more information about the controller.
Emitted when one of the input sources has finished its "primary squeeze action".
Use :ref:`get_input_source_tracker<class_WebXRInterface_method_get_input_source_tracker>` and :ref:`get_input_source_target_ray_mode<class_WebXRInterface_method_get_input_source_target_ray_mode>` to get more information about the input source.
.. rst-class:: classref-item-separator
----
.. _class_WebXRInterface_signal_squeezestart:
- **squeezestart** **(** :ref:`int<class_int>` controller_id **)**
.. rst-class:: classref-signal
Emitted when one of the "controllers" has started its "primary squeeze action".
**squeezestart** **(** :ref:`int<class_int>` input_source_id **)**
Use :ref:`get_controller<class_WebXRInterface_method_get_controller>` to get more information about the controller.
Emitted when one of the input sources has started its "primary squeeze action".
Use :ref:`get_input_source_tracker<class_WebXRInterface_method_get_input_source_tracker>` and :ref:`get_input_source_target_ray_mode<class_WebXRInterface_method_get_input_source_target_ray_mode>` to get more information about the input source.
.. rst-class:: classref-item-separator
----
.. _class_WebXRInterface_signal_visibility_state_changed:
- **visibility_state_changed** **(** **)**
.. rst-class:: classref-signal
**visibility_state_changed** **(** **)**
Emitted when :ref:`visibility_state<class_WebXRInterface_property_visibility_state>` has changed.
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Enumerations
------------
.. _enum_WebXRInterface_TargetRayMode:
.. rst-class:: classref-enumeration
enum **TargetRayMode**:
.. _class_WebXRInterface_constant_TARGET_RAY_MODE_UNKNOWN:
.. rst-class:: classref-enumeration-constant
:ref:`TargetRayMode<enum_WebXRInterface_TargetRayMode>` **TARGET_RAY_MODE_UNKNOWN** = ``0``
We don't know the the target ray mode.
.. _class_WebXRInterface_constant_TARGET_RAY_MODE_GAZE:
.. rst-class:: classref-enumeration-constant
:ref:`TargetRayMode<enum_WebXRInterface_TargetRayMode>` **TARGET_RAY_MODE_GAZE** = ``1``
Target ray originates at the viewer's eyes and points in the direction they are looking.
.. _class_WebXRInterface_constant_TARGET_RAY_MODE_TRACKED_POINTER:
.. rst-class:: classref-enumeration-constant
:ref:`TargetRayMode<enum_WebXRInterface_TargetRayMode>` **TARGET_RAY_MODE_TRACKED_POINTER** = ``2``
Target ray from a handheld pointer, most likely a VR touch controller.
.. _class_WebXRInterface_constant_TARGET_RAY_MODE_SCREEN:
.. rst-class:: classref-enumeration-constant
:ref:`TargetRayMode<enum_WebXRInterface_TargetRayMode>` **TARGET_RAY_MODE_SCREEN** = ``3``
Target ray from touch screen, mouse or other tactile input device.
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Property Descriptions
---------------------
.. _class_WebXRInterface_property_bounds_geometry:
- :ref:`PackedVector3Array<class_PackedVector3Array>` **bounds_geometry**
+----------+-----------------------+
| *Getter* | get_bounds_geometry() |
+----------+-----------------------+
The vertices of a polygon which defines the boundaries of the user's play area.
This will only be available if :ref:`reference_space_type<class_WebXRInterface_property_reference_space_type>` is ``"bounded-floor"`` and only on certain browsers and devices that support it.
The :ref:`reference_space_reset<class_WebXRInterface_signal_reference_space_reset>` signal may indicate when this changes.
----
.. _class_WebXRInterface_property_optional_features:
- :ref:`String<class_String>` **optional_features**
.. rst-class:: classref-property
+----------+------------------------------+
| *Setter* | set_optional_features(value) |
+----------+------------------------------+
| *Getter* | get_optional_features() |
+----------+------------------------------+
:ref:`String<class_String>` **optional_features**
.. rst-class:: classref-property-setget
- void **set_optional_features** **(** :ref:`String<class_String>` value **)**
- :ref:`String<class_String>` **get_optional_features** **(** **)**
A comma-seperated list of optional features used by :ref:`XRInterface.initialize<class_XRInterface_method_initialize>` when setting up the WebXR session.
@@ -302,51 +406,61 @@ This doesn't have any effect on the interface when already initialized.
Possible values come from `WebXR's XRReferenceSpaceType <https://developer.mozilla.org/en-US/docs/Web/API/XRReferenceSpaceType>`__. If you want to use a particular reference space type, it must be listed in either :ref:`required_features<class_WebXRInterface_property_required_features>` or :ref:`optional_features<class_WebXRInterface_property_optional_features>`.
.. rst-class:: classref-item-separator
----
.. _class_WebXRInterface_property_reference_space_type:
- :ref:`String<class_String>` **reference_space_type**
.. rst-class:: classref-property
+----------+----------------------------+
| *Getter* | get_reference_space_type() |
+----------+----------------------------+
:ref:`String<class_String>` **reference_space_type**
.. rst-class:: classref-property-setget
- :ref:`String<class_String>` **get_reference_space_type** **(** **)**
The reference space type (from the list of requested types set in the :ref:`requested_reference_space_types<class_WebXRInterface_property_requested_reference_space_types>` property), that was ultimately used by :ref:`XRInterface.initialize<class_XRInterface_method_initialize>` when setting up the WebXR session.
Possible values come from `WebXR's XRReferenceSpaceType <https://developer.mozilla.org/en-US/docs/Web/API/XRReferenceSpaceType>`__. If you want to use a particular reference space type, it must be listed in either :ref:`required_features<class_WebXRInterface_property_required_features>` or :ref:`optional_features<class_WebXRInterface_property_optional_features>`.
.. rst-class:: classref-item-separator
----
.. _class_WebXRInterface_property_requested_reference_space_types:
- :ref:`String<class_String>` **requested_reference_space_types**
.. rst-class:: classref-property
+----------+--------------------------------------------+
| *Setter* | set_requested_reference_space_types(value) |
+----------+--------------------------------------------+
| *Getter* | get_requested_reference_space_types() |
+----------+--------------------------------------------+
:ref:`String<class_String>` **requested_reference_space_types**
.. rst-class:: classref-property-setget
- void **set_requested_reference_space_types** **(** :ref:`String<class_String>` value **)**
- :ref:`String<class_String>` **get_requested_reference_space_types** **(** **)**
A comma-seperated list of reference space types used by :ref:`XRInterface.initialize<class_XRInterface_method_initialize>` when setting up the WebXR session.
The reference space types are requested in order, and the first on supported by the users device or browser will be used. The :ref:`reference_space_type<class_WebXRInterface_property_reference_space_type>` property contains the reference space type that was ultimately used.
The reference space types are requested in order, and the first one supported by the users device or browser will be used. The :ref:`reference_space_type<class_WebXRInterface_property_reference_space_type>` property contains the reference space type that was ultimately selected.
This doesn't have any effect on the interface when already initialized.
Possible values come from `WebXR's XRReferenceSpaceType <https://developer.mozilla.org/en-US/docs/Web/API/XRReferenceSpaceType>`__. If you want to use a particular reference space type, it must be listed in either :ref:`required_features<class_WebXRInterface_property_required_features>` or :ref:`optional_features<class_WebXRInterface_property_optional_features>`.
.. rst-class:: classref-item-separator
----
.. _class_WebXRInterface_property_required_features:
- :ref:`String<class_String>` **required_features**
.. rst-class:: classref-property
+----------+------------------------------+
| *Setter* | set_required_features(value) |
+----------+------------------------------+
| *Getter* | get_required_features() |
+----------+------------------------------+
:ref:`String<class_String>` **required_features**
.. rst-class:: classref-property-setget
- void **set_required_features** **(** :ref:`String<class_String>` value **)**
- :ref:`String<class_String>` **get_required_features** **(** **)**
A comma-seperated list of required features used by :ref:`XRInterface.initialize<class_XRInterface_method_initialize>` when setting up the WebXR session.
@@ -356,17 +470,20 @@ This doesn't have any effect on the interface when already initialized.
Possible values come from `WebXR's XRReferenceSpaceType <https://developer.mozilla.org/en-US/docs/Web/API/XRReferenceSpaceType>`__. If you want to use a particular reference space type, it must be listed in either :ref:`required_features<class_WebXRInterface_property_required_features>` or :ref:`optional_features<class_WebXRInterface_property_optional_features>`.
.. rst-class:: classref-item-separator
----
.. _class_WebXRInterface_property_session_mode:
- :ref:`String<class_String>` **session_mode**
.. rst-class:: classref-property
+----------+-------------------------+
| *Setter* | set_session_mode(value) |
+----------+-------------------------+
| *Getter* | get_session_mode() |
+----------+-------------------------+
:ref:`String<class_String>` **session_mode**
.. rst-class:: classref-property-setget
- void **set_session_mode** **(** :ref:`String<class_String>` value **)**
- :ref:`String<class_String>` **get_session_mode** **(** **)**
The session mode used by :ref:`XRInterface.initialize<class_XRInterface_method_initialize>` when setting up the WebXR session.
@@ -374,32 +491,58 @@ This doesn't have any effect on the interface when already initialized.
Possible values come from `WebXR's XRSessionMode <https://developer.mozilla.org/en-US/docs/Web/API/XRSessionMode>`__, including: ``"immersive-vr"``, ``"immersive-ar"``, and ``"inline"``.
.. rst-class:: classref-item-separator
----
.. _class_WebXRInterface_property_visibility_state:
- :ref:`String<class_String>` **visibility_state**
.. rst-class:: classref-property
+----------+------------------------+
| *Getter* | get_visibility_state() |
+----------+------------------------+
:ref:`String<class_String>` **visibility_state**
.. rst-class:: classref-property-setget
- :ref:`String<class_String>` **get_visibility_state** **(** **)**
Indicates if the WebXR session's imagery is visible to the user.
Possible values come from `WebXR's XRVisibilityState <https://developer.mozilla.org/en-US/docs/Web/API/XRVisibilityState>`__, including ``"hidden"``, ``"visible"``, and ``"visible-blurred"``.
.. rst-class:: classref-section-separator
----
.. rst-class:: classref-descriptions-group
Method Descriptions
-------------------
.. _class_WebXRInterface_method_get_controller:
.. _class_WebXRInterface_method_get_input_source_target_ray_mode:
- :ref:`XRPositionalTracker<class_XRPositionalTracker>` **get_controller** **(** :ref:`int<class_int>` controller_id **)** |const|
.. rst-class:: classref-method
Gets an :ref:`XRPositionalTracker<class_XRPositionalTracker>` for the given ``controller_id``.
:ref:`TargetRayMode<enum_WebXRInterface_TargetRayMode>` **get_input_source_target_ray_mode** **(** :ref:`int<class_int>` input_source_id **)** |const|
In the context of WebXR, a "controller" can be an advanced VR controller like the Oculus Touch or Index controllers, or even a tap on the screen, a spoken voice command or a button press on the device itself. When a non-traditional controller is used, interpret the position and orientation of the :ref:`XRPositionalTracker<class_XRPositionalTracker>` as a ray pointing at the object the user wishes to interact with.
Returns the target ray mode for the given ``input_source_id``.
Use this method to get information about the controller that triggered one of these signals:
This can help interpret the input coming from that input source. See `XRInputSource.targetRayMode <https://developer.mozilla.org/en-US/docs/Web/API/XRInputSource/targetRayMode>`__ for more information.
.. rst-class:: classref-item-separator
----
.. _class_WebXRInterface_method_get_input_source_tracker:
.. rst-class:: classref-method
:ref:`XRPositionalTracker<class_XRPositionalTracker>` **get_input_source_tracker** **(** :ref:`int<class_int>` input_source_id **)** |const|
Gets an :ref:`XRPositionalTracker<class_XRPositionalTracker>` for the given ``input_source_id``.
In the context of WebXR, an input source can be an advanced VR controller like the Oculus Touch or Index controllers, or even a tap on the screen, a spoken voice command or a button press on the device itself. When a non-traditional input source is used, interpret the position and orientation of the :ref:`XRPositionalTracker<class_XRPositionalTracker>` as a ray pointing at the object the user wishes to interact with.
Use this method to get information about the input source that triggered one of these signals:
- :ref:`selectstart<class_WebXRInterface_signal_selectstart>`\
@@ -413,11 +556,27 @@ Use this method to get information about the controller that triggered one of th
- :ref:`squeezestart<class_WebXRInterface_signal_squeezestart>`
.. rst-class:: classref-item-separator
----
.. _class_WebXRInterface_method_is_input_source_active:
.. rst-class:: classref-method
:ref:`bool<class_bool>` **is_input_source_active** **(** :ref:`int<class_int>` input_source_id **)** |const|
Returns ``true`` if there is an active input source with the given ``input_source_id``.
.. rst-class:: classref-item-separator
----
.. _class_WebXRInterface_method_is_session_supported:
- void **is_session_supported** **(** :ref:`String<class_String>` session_mode **)**
.. rst-class:: classref-method
void **is_session_supported** **(** :ref:`String<class_String>` session_mode **)**
Checks if the given ``session_mode`` is supported by the user's browser.