Documentation
¶
Overview ¶
The AR/VR server is the heart of our Advanced and Virtual Reality solution and handles all the processing.
Index ¶
- func AddInterface(intf XRInterface.Instance)
- func AddTracker(tracker XRTracker.Instance)
- func Advanced() class
- func CameraLockedToOrigin() bool
- func CenterOnHmd(rotation_mode RotationMode, keep_height bool)
- func ClearReferenceFrame()
- func FindInterface(name string) XRInterface.Instance
- func GetHmdTransform() Transform3D.BasisOrigin
- func GetInterface(idx int) XRInterface.Instance
- func GetInterfaceCount() int
- func GetInterfaces() []map[int]string
- func GetReferenceFrame() Transform3D.BasisOrigin
- func GetTracker(tracker_name string) XRTracker.Instance
- func GetTrackers(tracker_types int) map[interface{}]interface{}
- func OnInterfaceAdded(cb func(interface_name string), flags ...Signal.Flags)
- func OnInterfaceRemoved(cb func(interface_name string), flags ...Signal.Flags)
- func OnReferenceFrameChanged(cb func(), flags ...Signal.Flags)
- func OnTrackerAdded(cb func(tracker_name string, atype int), flags ...Signal.Flags)
- func OnTrackerRemoved(cb func(tracker_name string, atype int), flags ...Signal.Flags)
- func OnTrackerUpdated(cb func(tracker_name string, atype int), flags ...Signal.Flags)
- func PrimaryInterface() XRInterface.Instance
- func RemoveInterface(intf XRInterface.Instance)
- func RemoveTracker(tracker XRTracker.Instance)
- func SetCameraLockedToOrigin(value bool)
- func SetPrimaryInterface(value XRInterface.Instance)
- func SetWorldOrigin(value Transform3D.BasisOrigin)
- func SetWorldScale(value Float.X)
- func WorldOrigin() Transform3D.BasisOrigin
- func WorldScale() Float.X
- type Extension
- type ID
- type Instance
- type RotationMode
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddTracker ¶
Registers a new XRTracker that tracks a physical object.
func Advanced ¶
func Advanced() class
Advanced exposes a 1:1 low-level instance of the class, undocumented, for those who know what they are doing.
func CameraLockedToOrigin ¶
func CameraLockedToOrigin() bool
func CenterOnHmd ¶
func CenterOnHmd(rotation_mode RotationMode, keep_height bool)
This is an important function to understand correctly. AR and VR platforms all handle positioning slightly differently.
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.
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, it's often the location of the tracking camera.
This method allows you to center your tracker on the location of the HMD. It will take the current location of the HMD and use that to adjust all your tracking data; in essence, realigning the real world to your player's current position in the game world.
For this method to produce usable results, tracking information must be available. This often takes a few frames after starting your game.
You should call this method after a few seconds have passed. For example, when the user requests a realignment of the display holding a designated button on a controller for a short period of time, or when implementing a teleport mechanism.
func ClearReferenceFrame ¶
func ClearReferenceFrame()
Clears the reference frame that was set by previous calls to CenterOnHmd.
func FindInterface ¶
func FindInterface(name string) XRInterface.Instance
Finds an interface by its 'name'. For example, if your project uses capabilities of an AR/VR platform, you can find the interface for that platform by name and initialize it.
func GetHmdTransform ¶
func GetHmdTransform() Transform3D.BasisOrigin
Returns the primary interface's transformation.
func GetInterface ¶
func GetInterface(idx int) XRInterface.Instance
Returns the interface registered at the given 'idx' index in the list of interfaces.
func GetInterfaceCount ¶
func GetInterfaceCount() int
Returns the number of interfaces currently registered with the AR/VR server. If your project supports multiple AR/VR platforms, you can look through the available interface, and either present the user with a selection or simply try to initialize each interface and use the first one that returns true.
func GetInterfaces ¶
Returns a list of available interfaces the ID and name of each interface.
func GetReferenceFrame ¶
func GetReferenceFrame() Transform3D.BasisOrigin
Returns the reference frame transform. Mostly used internally and exposed for GDExtension build interfaces.
func GetTracker ¶
Returns the positional tracker with the given 'tracker_name'.
func GetTrackers ¶
func GetTrackers(tracker_types int) map[interface{}]interface{}
Returns a dictionary of trackers for 'tracker_types'.
func OnInterfaceAdded ¶
func OnInterfaceRemoved ¶
func OnReferenceFrameChanged ¶
func OnTrackerAdded ¶
func OnTrackerRemoved ¶
func OnTrackerUpdated ¶
func PrimaryInterface ¶
func PrimaryInterface() XRInterface.Instance
func SetCameraLockedToOrigin ¶
func SetCameraLockedToOrigin(value bool)
func SetPrimaryInterface ¶
func SetPrimaryInterface(value XRInterface.Instance)
func SetWorldOrigin ¶
func SetWorldOrigin(value Transform3D.BasisOrigin)
func SetWorldScale ¶
func WorldOrigin ¶
func WorldOrigin() Transform3D.BasisOrigin
func WorldScale ¶
Types ¶
type Extension ¶
Extension can be embedded in a new struct to create an extension of this class. T should be the type that is embedding this Extension
type ID ¶
ID is a typed object ID (reference) to an instance of this class, use it to store references to objects with unknown lifetimes, as an ID will not panic on use if the underlying object has been destroyed.
type RotationMode ¶
type RotationMode int //gd:XRServer.RotationMode
const ( // 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. ResetFullRotation RotationMode = 0 // 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. ResetButKeepTilt RotationMode = 1 // Does not reset the orientation of the HMD, only the position of the player gets centered. DontResetRotation RotationMode = 2 )