class_webxrinterface.rst 26 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592
  1. :github_url: hide
  2. .. DO NOT EDIT THIS FILE!!!
  3. .. Generated automatically from Godot engine sources.
  4. .. Generator: https://github.com/godotengine/godot/tree/4.0/doc/tools/make_rst.py.
  5. .. XML source: https://github.com/godotengine/godot/tree/4.0/modules/webxr/doc_classes/WebXRInterface.xml.
  6. .. _class_WebXRInterface:
  7. WebXRInterface
  8. ==============
  9. **Inherits:** :ref:`XRInterface<class_XRInterface>` **<** :ref:`RefCounted<class_RefCounted>` **<** :ref:`Object<class_Object>`
  10. XR interface using WebXR.
  11. .. rst-class:: classref-introduction-group
  12. Description
  13. -----------
  14. WebXR is an open standard that allows creating VR and AR applications that run in the web browser.
  15. As such, this interface is only available when running in Web exports.
  16. 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).
  17. 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.
  18. Here's the minimum code required to start an immersive VR session:
  19. ::
  20. extends Node3D
  21. var webxr_interface
  22. var vr_supported = false
  23. func _ready():
  24. # We assume this node has a button as a child.
  25. # This button is for the user to consent to entering immersive VR mode.
  26. $Button.pressed.connect(self._on_button_pressed)
  27. webxr_interface = XRServer.find_interface("WebXR")
  28. if webxr_interface:
  29. # WebXR uses a lot of asynchronous callbacks, so we connect to various
  30. # signals in order to receive them.
  31. webxr_interface.session_supported.connect(self._webxr_session_supported)
  32. webxr_interface.session_started.connect(self._webxr_session_started)
  33. webxr_interface.session_ended.connect(self._webxr_session_ended)
  34. webxr_interface.session_failed.connect(self._webxr_session_failed)
  35. # This returns immediately - our _webxr_session_supported() method
  36. # (which we connected to the "session_supported" signal above) will
  37. # be called sometime later to let us know if it's supported or not.
  38. webxr_interface.is_session_supported("immersive-vr")
  39. func _webxr_session_supported(session_mode, supported):
  40. if session_mode == 'immersive-vr':
  41. vr_supported = supported
  42. func _on_button_pressed():
  43. if not vr_supported:
  44. OS.alert("Your browser doesn't support VR")
  45. return
  46. # We want an immersive VR session, as opposed to AR ('immersive-ar') or a
  47. # simple 3DoF viewer ('viewer').
  48. webxr_interface.session_mode = 'immersive-vr'
  49. # 'bounded-floor' is room scale, 'local-floor' is a standing or sitting
  50. # experience (it puts you 1.6m above the ground if you have 3DoF headset),
  51. # whereas as 'local' puts you down at the XROrigin.
  52. # This list means it'll first try to request 'bounded-floor', then
  53. # fallback on 'local-floor' and ultimately 'local', if nothing else is
  54. # supported.
  55. webxr_interface.requested_reference_space_types = 'bounded-floor, local-floor, local'
  56. # In order to use 'local-floor' or 'bounded-floor' we must also
  57. # mark the features as required or optional.
  58. webxr_interface.required_features = 'local-floor'
  59. webxr_interface.optional_features = 'bounded-floor'
  60. # This will return false if we're unable to even request the session,
  61. # however, it can still fail asynchronously later in the process, so we
  62. # only know if it's really succeeded or failed when our
  63. # _webxr_session_started() or _webxr_session_failed() methods are called.
  64. if not webxr_interface.initialize():
  65. OS.alert("Failed to initialize")
  66. return
  67. func _webxr_session_started():
  68. $Button.visible = false
  69. # This tells Godot to start rendering to the headset.
  70. get_viewport().use_xr = true
  71. # This will be the reference space type you ultimately got, out of the
  72. # types that you requested above. This is useful if you want the game to
  73. # work a little differently in 'bounded-floor' versus 'local-floor'.
  74. print ("Reference space type: " + webxr_interface.reference_space_type)
  75. func _webxr_session_ended():
  76. $Button.visible = true
  77. # If the user exits immersive mode, then we tell Godot to render to the web
  78. # page again.
  79. get_viewport().use_xr = false
  80. func _webxr_session_failed(message):
  81. OS.alert("Failed to initialize: " + message)
  82. There are a couple ways to handle "controller" input:
  83. - 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.
  84. - 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.
  85. 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.
  86. .. rst-class:: classref-introduction-group
  87. Tutorials
  88. ---------
  89. - `How to make a VR game for WebXR with Godot 4 <https://www.snopekgames.com/tutorial/2023/how-make-vr-game-webxr-godot-4>`__
  90. .. rst-class:: classref-reftable-group
  91. Properties
  92. ----------
  93. .. table::
  94. :widths: auto
  95. +-----------------------------+-------------------------------------------------------------------------------------------------------+
  96. | :ref:`String<class_String>` | :ref:`optional_features<class_WebXRInterface_property_optional_features>` |
  97. +-----------------------------+-------------------------------------------------------------------------------------------------------+
  98. | :ref:`String<class_String>` | :ref:`reference_space_type<class_WebXRInterface_property_reference_space_type>` |
  99. +-----------------------------+-------------------------------------------------------------------------------------------------------+
  100. | :ref:`String<class_String>` | :ref:`requested_reference_space_types<class_WebXRInterface_property_requested_reference_space_types>` |
  101. +-----------------------------+-------------------------------------------------------------------------------------------------------+
  102. | :ref:`String<class_String>` | :ref:`required_features<class_WebXRInterface_property_required_features>` |
  103. +-----------------------------+-------------------------------------------------------------------------------------------------------+
  104. | :ref:`String<class_String>` | :ref:`session_mode<class_WebXRInterface_property_session_mode>` |
  105. +-----------------------------+-------------------------------------------------------------------------------------------------------+
  106. | :ref:`String<class_String>` | :ref:`visibility_state<class_WebXRInterface_property_visibility_state>` |
  107. +-----------------------------+-------------------------------------------------------------------------------------------------------+
  108. .. rst-class:: classref-reftable-group
  109. Methods
  110. -------
  111. .. table::
  112. :widths: auto
  113. +---------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  114. | :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| |
  115. +---------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  116. | :ref:`XRPositionalTracker<class_XRPositionalTracker>` | :ref:`get_input_source_tracker<class_WebXRInterface_method_get_input_source_tracker>` **(** :ref:`int<class_int>` input_source_id **)** |const| |
  117. +---------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  118. | :ref:`bool<class_bool>` | :ref:`is_input_source_active<class_WebXRInterface_method_is_input_source_active>` **(** :ref:`int<class_int>` input_source_id **)** |const| |
  119. +---------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  120. | void | :ref:`is_session_supported<class_WebXRInterface_method_is_session_supported>` **(** :ref:`String<class_String>` session_mode **)** |
  121. +---------------------------------------------------------+-----------------------------------------------------------------------------------------------------------------------------------------------------------------+
  122. .. rst-class:: classref-section-separator
  123. ----
  124. .. rst-class:: classref-descriptions-group
  125. Signals
  126. -------
  127. .. _class_WebXRInterface_signal_reference_space_reset:
  128. .. rst-class:: classref-signal
  129. **reference_space_reset** **(** **)**
  130. Emitted to indicate that the reference space has been reset or reconfigured.
  131. 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.
  132. See `WebXR's XRReferenceSpace reset event <https://developer.mozilla.org/en-US/docs/Web/API/XRReferenceSpace/reset_event>`__ for more information.
  133. .. rst-class:: classref-item-separator
  134. ----
  135. .. _class_WebXRInterface_signal_select:
  136. .. rst-class:: classref-signal
  137. **select** **(** :ref:`int<class_int>` input_source_id **)**
  138. Emitted after one of the input sources has finished its "primary action".
  139. 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.
  140. .. rst-class:: classref-item-separator
  141. ----
  142. .. _class_WebXRInterface_signal_selectend:
  143. .. rst-class:: classref-signal
  144. **selectend** **(** :ref:`int<class_int>` input_source_id **)**
  145. Emitted when one of the input sources has finished its "primary action".
  146. 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.
  147. .. rst-class:: classref-item-separator
  148. ----
  149. .. _class_WebXRInterface_signal_selectstart:
  150. .. rst-class:: classref-signal
  151. **selectstart** **(** :ref:`int<class_int>` input_source_id **)**
  152. Emitted when one of the input source has started its "primary action".
  153. 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.
  154. .. rst-class:: classref-item-separator
  155. ----
  156. .. _class_WebXRInterface_signal_session_ended:
  157. .. rst-class:: classref-signal
  158. **session_ended** **(** **)**
  159. Emitted when the user ends the WebXR session (which can be done using UI from the browser or device).
  160. At this point, you should do ``get_viewport().use_xr = false`` to instruct Godot to resume rendering to the screen.
  161. .. rst-class:: classref-item-separator
  162. ----
  163. .. _class_WebXRInterface_signal_session_failed:
  164. .. rst-class:: classref-signal
  165. **session_failed** **(** :ref:`String<class_String>` message **)**
  166. Emitted by :ref:`XRInterface.initialize<class_XRInterface_method_initialize>` if the session fails to start.
  167. \ ``message`` may optionally contain an error message from WebXR, or an empty string if no message is available.
  168. .. rst-class:: classref-item-separator
  169. ----
  170. .. _class_WebXRInterface_signal_session_started:
  171. .. rst-class:: classref-signal
  172. **session_started** **(** **)**
  173. Emitted by :ref:`XRInterface.initialize<class_XRInterface_method_initialize>` if the session is successfully started.
  174. At this point, it's safe to do ``get_viewport().use_xr = true`` to instruct Godot to start rendering to the XR device.
  175. .. rst-class:: classref-item-separator
  176. ----
  177. .. _class_WebXRInterface_signal_session_supported:
  178. .. rst-class:: classref-signal
  179. **session_supported** **(** :ref:`String<class_String>` session_mode, :ref:`bool<class_bool>` supported **)**
  180. Emitted by :ref:`is_session_supported<class_WebXRInterface_method_is_session_supported>` to indicate if the given ``session_mode`` is supported or not.
  181. .. rst-class:: classref-item-separator
  182. ----
  183. .. _class_WebXRInterface_signal_squeeze:
  184. .. rst-class:: classref-signal
  185. **squeeze** **(** :ref:`int<class_int>` input_source_id **)**
  186. Emitted after one of the input sources has finished its "primary squeeze action".
  187. 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.
  188. .. rst-class:: classref-item-separator
  189. ----
  190. .. _class_WebXRInterface_signal_squeezeend:
  191. .. rst-class:: classref-signal
  192. **squeezeend** **(** :ref:`int<class_int>` input_source_id **)**
  193. Emitted when one of the input sources has finished its "primary squeeze action".
  194. 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.
  195. .. rst-class:: classref-item-separator
  196. ----
  197. .. _class_WebXRInterface_signal_squeezestart:
  198. .. rst-class:: classref-signal
  199. **squeezestart** **(** :ref:`int<class_int>` input_source_id **)**
  200. Emitted when one of the input sources has started its "primary squeeze action".
  201. 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.
  202. .. rst-class:: classref-item-separator
  203. ----
  204. .. _class_WebXRInterface_signal_visibility_state_changed:
  205. .. rst-class:: classref-signal
  206. **visibility_state_changed** **(** **)**
  207. Emitted when :ref:`visibility_state<class_WebXRInterface_property_visibility_state>` has changed.
  208. .. rst-class:: classref-section-separator
  209. ----
  210. .. rst-class:: classref-descriptions-group
  211. Enumerations
  212. ------------
  213. .. _enum_WebXRInterface_TargetRayMode:
  214. .. rst-class:: classref-enumeration
  215. enum **TargetRayMode**:
  216. .. _class_WebXRInterface_constant_TARGET_RAY_MODE_UNKNOWN:
  217. .. rst-class:: classref-enumeration-constant
  218. :ref:`TargetRayMode<enum_WebXRInterface_TargetRayMode>` **TARGET_RAY_MODE_UNKNOWN** = ``0``
  219. We don't know the the target ray mode.
  220. .. _class_WebXRInterface_constant_TARGET_RAY_MODE_GAZE:
  221. .. rst-class:: classref-enumeration-constant
  222. :ref:`TargetRayMode<enum_WebXRInterface_TargetRayMode>` **TARGET_RAY_MODE_GAZE** = ``1``
  223. Target ray originates at the viewer's eyes and points in the direction they are looking.
  224. .. _class_WebXRInterface_constant_TARGET_RAY_MODE_TRACKED_POINTER:
  225. .. rst-class:: classref-enumeration-constant
  226. :ref:`TargetRayMode<enum_WebXRInterface_TargetRayMode>` **TARGET_RAY_MODE_TRACKED_POINTER** = ``2``
  227. Target ray from a handheld pointer, most likely a VR touch controller.
  228. .. _class_WebXRInterface_constant_TARGET_RAY_MODE_SCREEN:
  229. .. rst-class:: classref-enumeration-constant
  230. :ref:`TargetRayMode<enum_WebXRInterface_TargetRayMode>` **TARGET_RAY_MODE_SCREEN** = ``3``
  231. Target ray from touch screen, mouse or other tactile input device.
  232. .. rst-class:: classref-section-separator
  233. ----
  234. .. rst-class:: classref-descriptions-group
  235. Property Descriptions
  236. ---------------------
  237. .. _class_WebXRInterface_property_optional_features:
  238. .. rst-class:: classref-property
  239. :ref:`String<class_String>` **optional_features**
  240. .. rst-class:: classref-property-setget
  241. - void **set_optional_features** **(** :ref:`String<class_String>` value **)**
  242. - :ref:`String<class_String>` **get_optional_features** **(** **)**
  243. A comma-seperated list of optional features used by :ref:`XRInterface.initialize<class_XRInterface_method_initialize>` when setting up the WebXR session.
  244. If a user's browser or device doesn't support one of the given features, initialization will continue, but you won't be able to use the requested feature.
  245. This doesn't have any effect on the interface when already initialized.
  246. 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>`.
  247. .. rst-class:: classref-item-separator
  248. ----
  249. .. _class_WebXRInterface_property_reference_space_type:
  250. .. rst-class:: classref-property
  251. :ref:`String<class_String>` **reference_space_type**
  252. .. rst-class:: classref-property-setget
  253. - :ref:`String<class_String>` **get_reference_space_type** **(** **)**
  254. 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.
  255. 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>`.
  256. .. rst-class:: classref-item-separator
  257. ----
  258. .. _class_WebXRInterface_property_requested_reference_space_types:
  259. .. rst-class:: classref-property
  260. :ref:`String<class_String>` **requested_reference_space_types**
  261. .. rst-class:: classref-property-setget
  262. - void **set_requested_reference_space_types** **(** :ref:`String<class_String>` value **)**
  263. - :ref:`String<class_String>` **get_requested_reference_space_types** **(** **)**
  264. A comma-seperated list of reference space types used by :ref:`XRInterface.initialize<class_XRInterface_method_initialize>` when setting up the WebXR session.
  265. 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.
  266. This doesn't have any effect on the interface when already initialized.
  267. 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>`.
  268. .. rst-class:: classref-item-separator
  269. ----
  270. .. _class_WebXRInterface_property_required_features:
  271. .. rst-class:: classref-property
  272. :ref:`String<class_String>` **required_features**
  273. .. rst-class:: classref-property-setget
  274. - void **set_required_features** **(** :ref:`String<class_String>` value **)**
  275. - :ref:`String<class_String>` **get_required_features** **(** **)**
  276. A comma-seperated list of required features used by :ref:`XRInterface.initialize<class_XRInterface_method_initialize>` when setting up the WebXR session.
  277. If a user's browser or device doesn't support one of the given features, initialization will fail and :ref:`session_failed<class_WebXRInterface_signal_session_failed>` will be emitted.
  278. This doesn't have any effect on the interface when already initialized.
  279. 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>`.
  280. .. rst-class:: classref-item-separator
  281. ----
  282. .. _class_WebXRInterface_property_session_mode:
  283. .. rst-class:: classref-property
  284. :ref:`String<class_String>` **session_mode**
  285. .. rst-class:: classref-property-setget
  286. - void **set_session_mode** **(** :ref:`String<class_String>` value **)**
  287. - :ref:`String<class_String>` **get_session_mode** **(** **)**
  288. The session mode used by :ref:`XRInterface.initialize<class_XRInterface_method_initialize>` when setting up the WebXR session.
  289. This doesn't have any effect on the interface when already initialized.
  290. Possible values come from `WebXR's XRSessionMode <https://developer.mozilla.org/en-US/docs/Web/API/XRSessionMode>`__, including: ``"immersive-vr"``, ``"immersive-ar"``, and ``"inline"``.
  291. .. rst-class:: classref-item-separator
  292. ----
  293. .. _class_WebXRInterface_property_visibility_state:
  294. .. rst-class:: classref-property
  295. :ref:`String<class_String>` **visibility_state**
  296. .. rst-class:: classref-property-setget
  297. - :ref:`String<class_String>` **get_visibility_state** **(** **)**
  298. Indicates if the WebXR session's imagery is visible to the user.
  299. Possible values come from `WebXR's XRVisibilityState <https://developer.mozilla.org/en-US/docs/Web/API/XRVisibilityState>`__, including ``"hidden"``, ``"visible"``, and ``"visible-blurred"``.
  300. .. rst-class:: classref-section-separator
  301. ----
  302. .. rst-class:: classref-descriptions-group
  303. Method Descriptions
  304. -------------------
  305. .. _class_WebXRInterface_method_get_input_source_target_ray_mode:
  306. .. rst-class:: classref-method
  307. :ref:`TargetRayMode<enum_WebXRInterface_TargetRayMode>` **get_input_source_target_ray_mode** **(** :ref:`int<class_int>` input_source_id **)** |const|
  308. Returns the target ray mode for the given ``input_source_id``.
  309. 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.
  310. .. rst-class:: classref-item-separator
  311. ----
  312. .. _class_WebXRInterface_method_get_input_source_tracker:
  313. .. rst-class:: classref-method
  314. :ref:`XRPositionalTracker<class_XRPositionalTracker>` **get_input_source_tracker** **(** :ref:`int<class_int>` input_source_id **)** |const|
  315. Gets an :ref:`XRPositionalTracker<class_XRPositionalTracker>` for the given ``input_source_id``.
  316. 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.
  317. Use this method to get information about the input source that triggered one of these signals:
  318. - :ref:`selectstart<class_WebXRInterface_signal_selectstart>`\
  319. - :ref:`select<class_WebXRInterface_signal_select>`\
  320. - :ref:`selectend<class_WebXRInterface_signal_selectend>`\
  321. - :ref:`squeezestart<class_WebXRInterface_signal_squeezestart>`\
  322. - :ref:`squeeze<class_WebXRInterface_signal_squeeze>`\
  323. - :ref:`squeezestart<class_WebXRInterface_signal_squeezestart>`
  324. .. rst-class:: classref-item-separator
  325. ----
  326. .. _class_WebXRInterface_method_is_input_source_active:
  327. .. rst-class:: classref-method
  328. :ref:`bool<class_bool>` **is_input_source_active** **(** :ref:`int<class_int>` input_source_id **)** |const|
  329. Returns ``true`` if there is an active input source with the given ``input_source_id``.
  330. .. rst-class:: classref-item-separator
  331. ----
  332. .. _class_WebXRInterface_method_is_session_supported:
  333. .. rst-class:: classref-method
  334. void **is_session_supported** **(** :ref:`String<class_String>` session_mode **)**
  335. Checks if the given ``session_mode`` is supported by the user's browser.
  336. Possible values come from `WebXR's XRSessionMode <https://developer.mozilla.org/en-US/docs/Web/API/XRSessionMode>`__, including: ``"immersive-vr"``, ``"immersive-ar"``, and ``"inline"``.
  337. This method returns nothing, instead it emits the :ref:`session_supported<class_WebXRInterface_signal_session_supported>` signal with the result.
  338. .. |virtual| replace:: :abbr:`virtual (This method should typically be overridden by the user to have any effect.)`
  339. .. |const| replace:: :abbr:`const (This method has no side effects. It doesn't modify any of the instance's member variables.)`
  340. .. |vararg| replace:: :abbr:`vararg (This method accepts any number of arguments after the ones described here.)`
  341. .. |constructor| replace:: :abbr:`constructor (This method is used to construct a type.)`
  342. .. |static| replace:: :abbr:`static (This method doesn't need an instance to be called, so it can be called directly using the class name.)`
  343. .. |operator| replace:: :abbr:`operator (This method describes a valid operator to use with this type as left-hand operand.)`