passthrough.rst 2.0 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. .. _doc_passthrough:
  2. Passthrough
  3. ===========
  4. .. note::
  5. Only available in versions **1.1.1 and later** of the OpenXR plugin.
  6. Passthrough is a new feature introduced on the Meta Quest and added to the OpenXR spec as a Meta extension.
  7. It is likely this implementation will be implemented by other vendors where the hardware supports a passthrough mode
  8. and promoted to core at some point.
  9. Keep in mind that this feature is not guaranteed to be available.
  10. Passthrough allows for the camera input on the headset to be used within the headset so the user can see the real world.
  11. This allows us to implement an AR-like experience in a VR headset.
  12. If you are using the ``first person controller`` scene, you can simply
  13. enable passthrough by checking the **Start Passthrough** option
  14. on the controller node:
  15. .. image:: img/start_passthrough.png
  16. If you rather do this through code, you will first need to create an instance
  17. of the ``OpenXRConfig`` object.
  18. You can do this the same way the ``first person controller`` does
  19. and assign the ``OpenXRConfig.gdns`` as the script to a node,
  20. or you can instance it in code as shown below:
  21. .. code::
  22. var openxr_config = null
  23. func _ready():
  24. var config_gdns = load("res://addons/godot_ovrmobile/OvrInitConfig.gdns")
  25. if config_gdns:
  26. openxr_config = config_gdns.new()
  27. func start_passthrough():
  28. if openxr_config:
  29. return openxr_config.start_passthrough()
  30. else:
  31. return false
  32. func stop_passthrough():
  33. if openxr_config:
  34. openxr_config.stop_passthrough()
  35. .. note::
  36. The Viewport's **Transparent Bg** property must be enabled prior to starting passthrough.
  37. The plugin will log a warning message if it detects an incorrect configuration.
  38. .. seealso::
  39. A fix for a bug related to turning transparent background on/off
  40. is scheduled for the Godot 3.4.3 release. If you wish to toggle passthrough
  41. in your game, you will need to be on that version or newer.