class_arvrserver.rst 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169
  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:`add_interface<class_ARVRServer_add_interface>` **(** :ref:`ARVRInterface<class_arvrinterface>` interface **)** |
  16. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
  17. | void | :ref:`center_on_hmd<class_ARVRServer_center_on_hmd>` **(** :ref:`bool<class_bool>` ignore_tilt, :ref:`bool<class_bool>` keep_height **)** |
  18. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
  19. | :ref:`ARVRInterface<class_arvrinterface>` | :ref:`find_interface<class_ARVRServer_find_interface>` **(** :ref:`String<class_string>` name **)** const |
  20. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
  21. | :ref:`ARVRInterface<class_arvrinterface>` | :ref:`get_interface<class_ARVRServer_get_interface>` **(** :ref:`int<class_int>` idx **)** const |
  22. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
  23. | :ref:`int<class_int>` | :ref:`get_interface_count<class_ARVRServer_get_interface_count>` **(** **)** 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. | :ref:`float<class_float>` | :ref:`get_world_scale<class_ARVRServer_get_world_scale>` **(** **)** const |
  32. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
  33. | void | :ref:`remove_interface<class_ARVRServer_remove_interface>` **(** :ref:`ARVRInterface<class_arvrinterface>` interface **)** |
  34. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
  35. | void | :ref:`set_primary_interface<class_ARVRServer_set_primary_interface>` **(** :ref:`ARVRInterface<class_arvrinterface>` interface **)** |
  36. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
  37. | void | :ref:`set_world_scale<class_ARVRServer_set_world_scale>` **(** :ref:`float<class_float>` arg0 **)** |
  38. +------------------------------------------------------------+---------------------------------------------------------------------------------------------------------------------------------------------+
  39. Signals
  40. -------
  41. - **interface_added** **(** :ref:`String<class_string>` name **)**
  42. Signal send when a new interface has been added.
  43. - **interface_removed** **(** :ref:`String<class_string>` name **)**
  44. Signal send when an interface is removed.
  45. - **tracker_added** **(** :ref:`String<class_string>` name, :ref:`int<class_int>` type, :ref:`int<class_int>` id **)**
  46. 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.
  47. - **tracker_removed** **(** :ref:`String<class_string>` name, :ref:`int<class_int>` type, :ref:`int<class_int>` id **)**
  48. 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).
  49. Member Variables
  50. ----------------
  51. - :ref:`float<class_float>` **world_scale**
  52. Numeric Constants
  53. -----------------
  54. - **TRACKER_CONTROLLER** = **1** --- Our tracker tracks the location of a controller.
  55. - **TRACKER_BASESTATION** = **2** --- Our tracker tracks the location of a base station.
  56. - **TRACKER_ANCHOR** = **4** --- Our tracker tracks the location and size of an AR anchor.
  57. - **TRACKER_UNKNOWN** = **128** --- Used internally if we haven't set the tracker type yet.
  58. - **TRACKER_ANY_KNOWN** = **127** --- Used internally to filter trackers of any known type.
  59. - **TRACKER_ANY** = **255** --- Used interally to select all trackers.
  60. Description
  61. -----------
  62. The AR/VR Server is the heart of our AR/VR solution and handles all the processing.
  63. Member Function Description
  64. ---------------------------
  65. .. _class_ARVRServer_add_interface:
  66. - void **add_interface** **(** :ref:`ARVRInterface<class_arvrinterface>` interface **)**
  67. Mostly exposed for GDNative based interfaces, this is called to register an available interface with the AR/VR server.
  68. .. _class_ARVRServer_center_on_hmd:
  69. - void **center_on_hmd** **(** :ref:`bool<class_bool>` ignore_tilt, :ref:`bool<class_bool>` keep_height **)**
  70. This is a really important function to understand correctly. AR and VR platforms all handle positioning slightly differently.
  71. 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.
  72. 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.
  73. 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.
  74. For this method to produce usable results tracking information should be available and this often takes a few frames after starting your game.
  75. 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.
  76. .. _class_ARVRServer_find_interface:
  77. - :ref:`ARVRInterface<class_arvrinterface>` **find_interface** **(** :ref:`String<class_string>` name **)** const
  78. 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.
  79. .. _class_ARVRServer_get_interface:
  80. - :ref:`ARVRInterface<class_arvrinterface>` **get_interface** **(** :ref:`int<class_int>` idx **)** const
  81. Get the interface registered at a given index in our list of interfaces.
  82. .. _class_ARVRServer_get_interface_count:
  83. - :ref:`int<class_int>` **get_interface_count** **(** **)** const
  84. Get the number of interfaces currently registered with the AR/VR server. If you're game supports multiple AR/VR platforms you can look throught 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.
  85. .. _class_ARVRServer_get_reference_frame:
  86. - :ref:`Transform<class_transform>` **get_reference_frame** **(** **)** const
  87. Gets our reference frame transform, mostly used internally and exposed for GDNative build interfaces.
  88. .. _class_ARVRServer_get_tracker:
  89. - :ref:`ARVRPositionalTracker<class_arvrpositionaltracker>` **get_tracker** **(** :ref:`int<class_int>` idx **)** const
  90. Get the positional tracker at the given ID.
  91. .. _class_ARVRServer_get_tracker_count:
  92. - :ref:`int<class_int>` **get_tracker_count** **(** **)** const
  93. Get the number of trackers currently registered.
  94. .. _class_ARVRServer_get_world_scale:
  95. - :ref:`float<class_float>` **get_world_scale** **(** **)** const
  96. Returns our world scale (see ARVROrigin for more information).
  97. .. _class_ARVRServer_remove_interface:
  98. - void **remove_interface** **(** :ref:`ARVRInterface<class_arvrinterface>` interface **)**
  99. Removes a registered interface, again exposed mostly for GDNative based interfaces.
  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.
  103. .. _class_ARVRServer_set_world_scale:
  104. - void **set_world_scale** **(** :ref:`float<class_float>` arg0 **)**
  105. Changing the world scale, see the ARVROrigin documentation for more information.