class_arvrserver.rst 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174
  1. .. Generated automatically by doc/tools/makerst.py in Godot's source tree.
  2. .. DO NOT EDIT THIS FILE, but the ARVRServer.xml source instead.
  3. .. The source is found in doc/classes or modules/<name>/doc_classes.
  4. .. _class_ARVRServer:
  5. ARVRServer
  6. ==========
  7. **Inherits:** :ref:`Object<class_object>`
  8. **Category:** Core
  9. Brief Description
  10. -----------------
  11. This is our AR/VR Server.
  12. Member Functions
  13. ----------------
  14. +------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  15. | void | :ref:`center_on_hmd<class_ARVRServer_center_on_hmd>` **(** :ref:`int<class_int>` rotation_mode, :ref:`bool<class_bool>` keep_height **)** |
  16. +------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  17. | :ref:`ARVRInterface<class_arvrinterface>` | :ref:`find_interface<class_ARVRServer_find_interface>` **(** :ref:`String<class_string>` name **)** const |
  18. +------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  19. | :ref:`ARVRInterface<class_arvrinterface>` | :ref:`get_interface<class_ARVRServer_get_interface>` **(** :ref:`int<class_int>` idx **)** const |
  20. +------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  21. | :ref:`int<class_int>` | :ref:`get_interface_count<class_ARVRServer_get_interface_count>` **(** **)** const |
  22. +------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  23. | :ref:`Array<class_array>` | :ref:`get_interfaces<class_ARVRServer_get_interfaces>` **(** **)** const |
  24. +------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  25. | :ref:`Transform<class_transform>` | :ref:`get_reference_frame<class_ARVRServer_get_reference_frame>` **(** **)** const |
  26. +------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  27. | :ref:`ARVRPositionalTracker<class_arvrpositionaltracker>` | :ref:`get_tracker<class_ARVRServer_get_tracker>` **(** :ref:`int<class_int>` idx **)** const |
  28. +------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  29. | :ref:`int<class_int>` | :ref:`get_tracker_count<class_ARVRServer_get_tracker_count>` **(** **)** const |
  30. +------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  31. | void | :ref:`set_primary_interface<class_ARVRServer_set_primary_interface>` **(** :ref:`ARVRInterface<class_arvrinterface>` interface **)** |
  32. +------------------------------------------------------------+-------------------------------------------------------------------------------------------------------------------------------------------+
  33. Signals
  34. -------
  35. .. _class_ARVRServer_interface_added:
  36. - **interface_added** **(** :ref:`String<class_string>` interface_name **)**
  37. Signal send when a new interface has been added.
  38. .. _class_ARVRServer_interface_removed:
  39. - **interface_removed** **(** :ref:`String<class_string>` interface_name **)**
  40. Signal send when an interface is removed.
  41. .. _class_ARVRServer_tracker_added:
  42. - **tracker_added** **(** :ref:`String<class_string>` tracker_name, :ref:`int<class_int>` type, :ref:`int<class_int>` id **)**
  43. Signal send when a new tracker has been added. If you don't use a fixed number of controllers or if you're using ARVRAnchors for an AR solution it is important to react to this signal and add the appropriate ARVRController or ARVRAnchor node related to this new tracker.
  44. .. _class_ARVRServer_tracker_removed:
  45. - **tracker_removed** **(** :ref:`String<class_string>` tracker_name, :ref:`int<class_int>` type, :ref:`int<class_int>` id **)**
  46. Signal send when a tracker is removed, you should remove any ARVRController or ARVRAnchor points if applicable. This is not mandatory, the nodes simply become inactive and will be made active again when a new tracker becomes available (i.e. a new controller is switched on that takes the place of the previous one).
  47. Member Variables
  48. ----------------
  49. .. _class_ARVRServer_world_scale:
  50. - :ref:`float<class_float>` **world_scale** - Allows you to adjust the scale to your game's units. Most AR/VR platforms assume a scale of 1 game world unit = 1 meter in the real world.
  51. Enums
  52. -----
  53. .. _enum_ARVRServer_RotationMode:
  54. enum **RotationMode**
  55. - **RESET_FULL_ROTATION** = **0** --- Fully reset the orientation of the HMD. Regardless of what direction the user is looking to in the real world. The user will look dead ahead in the virtual world.
  56. - **RESET_BUT_KEEP_TILT** = **1** --- Resets the orientation but keeps the tilt of the device. So if we're looking down, we keep looking down but heading will be reset.
  57. - **DONT_RESET_ROTATION** = **2** --- Does not reset the orientation of the HMD, only the position of the player gets centered.
  58. .. _enum_ARVRServer_TrackerType:
  59. enum **TrackerType**
  60. - **TRACKER_CONTROLLER** = **1** --- Our tracker tracks the location of a controller.
  61. - **TRACKER_BASESTATION** = **2** --- Our tracker tracks the location of a base station.
  62. - **TRACKER_ANCHOR** = **4** --- Our tracker tracks the location and size of an AR anchor.
  63. - **TRACKER_ANY_KNOWN** = **127** --- Used internally to filter trackers of any known type.
  64. - **TRACKER_UNKNOWN** = **128** --- Used internally if we haven't set the tracker type yet.
  65. - **TRACKER_ANY** = **255** --- Used internally to select all trackers.
  66. Description
  67. -----------
  68. The AR/VR Server is the heart of our AR/VR solution and handles all the processing.
  69. Member Function Description
  70. ---------------------------
  71. .. _class_ARVRServer_center_on_hmd:
  72. - void **center_on_hmd** **(** :ref:`int<class_int>` rotation_mode, :ref:`bool<class_bool>` keep_height **)**
  73. This is a really important function to understand correctly. AR and VR platforms all handle positioning slightly differently.
  74. For platforms that do not offer spatial tracking our origin point (0,0,0) is the location of our HMD but you have little control over the direction the player is facing in the real world.
  75. For platforms that do offer spatial tracking our origin point depends very much on the system. For OpenVR our origin point is usually the center of the tracking space, on the ground. For other platforms its often the location of the tracking camera.
  76. This method allows you to center our tracker on the location of the HMD, it will take the current location of the HMD and use that to adjust all our tracking data in essence realigning the real world to your players current position in your game world.
  77. For this method to produce usable results tracking information should be available and this often takes a few frames after starting your game.
  78. You should call this method after a few seconds have passed, when the user requests a realignment of the display holding a designated button on a controller for a short period of time, and when implementing a teleport mechanism.
  79. .. _class_ARVRServer_find_interface:
  80. - :ref:`ARVRInterface<class_arvrinterface>` **find_interface** **(** :ref:`String<class_string>` name **)** const
  81. Find an interface by its name. Say that you're making a game that uses specific capabilities of an AR/VR platform you can find the interface for that platform by name and initialize it.
  82. .. _class_ARVRServer_get_interface:
  83. - :ref:`ARVRInterface<class_arvrinterface>` **get_interface** **(** :ref:`int<class_int>` idx **)** const
  84. Get the interface registered at a given index in our list of interfaces.
  85. .. _class_ARVRServer_get_interface_count:
  86. - :ref:`int<class_int>` **get_interface_count** **(** **)** const
  87. Get the number of interfaces currently registered with the AR/VR server. If you're game supports multiple AR/VR platforms you can look through the available interface and either present the user with a selection or simply try an initialize each interface and use the first one that returns true.
  88. .. _class_ARVRServer_get_interfaces:
  89. - :ref:`Array<class_array>` **get_interfaces** **(** **)** const
  90. Returns a list of available interfaces with both id and name of the interface.
  91. .. _class_ARVRServer_get_reference_frame:
  92. - :ref:`Transform<class_transform>` **get_reference_frame** **(** **)** const
  93. Gets our reference frame transform, mostly used internally and exposed for GDNative build interfaces.
  94. .. _class_ARVRServer_get_tracker:
  95. - :ref:`ARVRPositionalTracker<class_arvrpositionaltracker>` **get_tracker** **(** :ref:`int<class_int>` idx **)** const
  96. Get the positional tracker at the given ID.
  97. .. _class_ARVRServer_get_tracker_count:
  98. - :ref:`int<class_int>` **get_tracker_count** **(** **)** const
  99. Get the number of trackers currently registered.
  100. .. _class_ARVRServer_set_primary_interface:
  101. - void **set_primary_interface** **(** :ref:`ARVRInterface<class_arvrinterface>` interface **)**
  102. Changes the primary interface to the specified interface. Again mostly exposed for GDNative interfaces.