Up to date
This page is up to date for Godot 4.2
.
If you still find outdated information, please open an issue.
XRServer¶
Inherits: Object
Server for AR and VR features.
Description¶
The AR/VR server is the heart of our Advanced and Virtual Reality solution and handles all the processing.
Tutorials¶
Properties¶
|
||
|
Methods¶
void |
add_interface ( XRInterface interface ) |
void |
add_tracker ( XRPositionalTracker tracker ) |
void |
center_on_hmd ( RotationMode rotation_mode, bool keep_height ) |
find_interface ( String name ) const |
|
get_interface ( int idx ) const |
|
get_interface_count ( ) const |
|
get_interfaces ( ) const |
|
get_reference_frame ( ) const |
|
get_tracker ( StringName tracker_name ) const |
|
get_trackers ( int tracker_types ) |
|
void |
remove_interface ( XRInterface interface ) |
void |
remove_tracker ( XRPositionalTracker tracker ) |
Signals¶
interface_added ( StringName interface_name )
Emitted when a new interface has been added.
interface_removed ( StringName interface_name )
Emitted when an interface is removed.
tracker_added ( StringName tracker_name, int type )
Emitted when a new tracker has been added. If you don't use a fixed number of controllers or if you're using XRAnchor3Ds for an AR solution, it is important to react to this signal to add the appropriate XRController3D or XRAnchor3D nodes related to this new tracker.
tracker_removed ( StringName tracker_name, int type )
Emitted when a tracker is removed. You should remove any XRController3D or XRAnchor3D 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).
tracker_updated ( StringName tracker_name, int type )
Emitted when an existing tracker has been updated. This can happen if the user switches controllers.
Enumerations¶
enum TrackerType:
TrackerType TRACKER_HEAD = 1
The tracker tracks the location of the players head. This is usually a location centered between the players eyes. Note that for handheld AR devices this can be the current location of the device.
TrackerType TRACKER_CONTROLLER = 2
The tracker tracks the location of a controller.
TrackerType TRACKER_BASESTATION = 4
The tracker tracks the location of a base station.
TrackerType TRACKER_ANCHOR = 8
The tracker tracks the location and size of an AR anchor.
TrackerType TRACKER_ANY_KNOWN = 127
Used internally to filter trackers of any known type.
TrackerType TRACKER_UNKNOWN = 128
Used internally if we haven't set the tracker type yet.
TrackerType TRACKER_ANY = 255
Used internally to select all trackers.
enum RotationMode:
RotationMode 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.
RotationMode 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.