introducing_xr_tools.rst 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. .. _doc_introducing_xr_tools:
  2. Introducing XR tools
  3. ====================
  4. Out of the box Godot gives you all the basic support to setup an XR project.
  5. XR specific game mechanics however need to be implemented on top of this foundation.
  6. While Godot makes this relatively easy this can still be a daunting task.
  7. For this reason Godot has developed a toolkit called `Godot XR Tools <https://github.com/GodotVR/godot-xr-tools>`_
  8. that implements many of the basic mechanics found in XR games, from locomotion to object interaction to UI interaction.
  9. This toolkit is designed to work with both OpenXR and WebXR runtimes.
  10. We'll be using this as a base for our documentation here.
  11. It helps developers hit the ground running but for more specific use cases building your own logic is just as valid.
  12. In that case XR tools can help in providing inspiration.
  13. .. note::
  14. The current stable release of Godot XR Tools available on the Asset Library is the version for Godot 3.
  15. The port of Godot XR Tools for Godot 4 is available for download from the github website.
  16. We will walk through the step of downloading and installing it here.
  17. We will update the documentation once Godot XR Tools becomes available for Godot 4 through the asset library.
  18. Installing XR Tools
  19. -------------------
  20. Continuing on from our project we started in :ref:`doc_setting_up_xr` we want to add in the Godot XR Tools library.
  21. This can be downloaded from the `Godot XR Tools releases page <https://github.com/GodotVR/godot-xr-tools/releases>`_.
  22. Find the latest release for Godot 4, and under **Assets**, download the
  23. ``godot-xr-tools.zip`` file.
  24. Once downloaded unzip the file.
  25. You will notice the files are held within a ``godot-xr-tools`` subfolder.
  26. Inside of this folder you will find an ``addons`` folder.
  27. It is this folder that you want to copy in its entirety to your Godot project folder, your project should now look something like this:
  28. .. image:: img/godot_xr_tools_root_folder.webp
  29. Now open up your project in Godot, if you haven't already, and give it a minute or so to import all the resources of the plugin.
  30. Next open the ``Project`` menu and select ``Project Settings..``.
  31. Now go to the ``Plugins`` tab and enable the plugin.
  32. .. image:: img/godot_xr_tools_enable.webp
  33. Basic hands
  34. -----------
  35. Just to get a feel of things we're going to add a few standard components that dress up our scene starting with hands for our player.
  36. OpenXR supports full hand tracking however there currently are significant differences in capabilities between the different XR Runtimes.
  37. As a reliable alternative Godot XR Tools comes with a number of rigged hand scenes that react on trigger and grip inputs of your controller.
  38. These hands come in low and high poly versions, come in a few configurations, a number of animation files to control finger positions and a number of different textures.
  39. In your scene tree select your left hand :ref:`XRController3D <class_xrcontroller3d>` node.
  40. Now click on the ``instantiate Child Scene`` button to add a child scene.
  41. And select ``addons/godot-xr-tools/hands/scenes/lowpoly/left_hand_low.tscn``.
  42. As you can see from the path of this scene, low poly models are in the ``lowpoly`` subfolder while high poly models are in the ``highpoly`` subfolder.
  43. You will want to use the low poly versions if you plan to release your game on mobile devices.
  44. The default hand we chose is just a hand. The other options are:
  45. * tac_glove - the hand is wearing a glove with fingers exposed
  46. * full_glove - the hand is wearing a glove that covers the entire hand
  47. Finally each hand comes in a ``physics`` version.
  48. This exposes all the bones.
  49. We'll look at how that can be used in another tutorial.
  50. We repeat the same for the right hand.
  51. .. image:: img/xr_tools_basic_hands.webp
  52. More information
  53. ----------------
  54. We'll continue with adding features to our tutorial project using Godot XR tools in the next couple of pages.
  55. More detailed information about the toolkit can be found `on the toolkits help pages <https://godotvr.github.io/godot-xr-tools/>`_.