Signal4
Signal support.
XRServer.swift:903class Signal4
Use the connect(flags:_:)
method to connect to the signal on the container object, and disconnect(_:)
to drop the connection.
You can also await the emitted
property for waiting for a single emission of the signal.
Other members in extension
View members
Hide members
This section is hidden by default because it contains too many (29) members.
Types
enum RotationMode
class Signal1
Signal support.
class Signal2
Signal support.
class Signal3
Signal support.
class Signal5
Signal support.
enum TrackerType
Type members
static var primaryInterface: XRInterface?
The primary
XRInterface
currently bound to theXRServer
.static var worldOrigin: Transform3D
The current origin of our tracking space in the virtual world. This is used by the renderer to properly position the camera with new tracking data.
static var worldScale: Double
Allows you to adjust the scale to your game’s units. Most AR/VR platforms assume a scale of 1 game world unit = 1 real world meter.
static func addInterface(XRInterface?
) Registers an
XRInterface
object.static func addTracker(XRPositionalTracker?
) Registers a new
XRPositionalTracker
that tracks a spatial location in real space.static func centerOnHmd(rotationMode: XRServer.RotationMode, keepHeight: Bool
) This is an important function to understand correctly. AR and VR platforms all handle positioning slightly differently.
static func findInterface(name: String
) -> XRInterface? 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.static func getHmdTransform(
) -> Transform3D Returns the primary interface’s transformation.
static func getInterface(idx: Int32
) -> XRInterface? Returns the interface registered at the given
idx
index in the list of interfaces.static func getInterfaceCount(
) -> Int32 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
.static func getInterfaces(
) -> VariantCollection<GDictionary> Returns a list of available interfaces the ID and name of each interface.
static func getReferenceFrame(
) -> Transform3D Returns the reference frame transform. Mostly used internally and exposed for GDExtension build interfaces.
static func getTracker(trackerName: StringName
) -> XRPositionalTracker? Returns the positional tracker with the given
trackerName
.static func getTrackers(trackerTypes: Int32
) -> GDictionary Returns a dictionary of trackers for
trackerTypes
.static func removeInterface(XRInterface?
) Removes this
interface
.static func removeTracker(XRPositionalTracker?
) Removes this positional
tracker
.class var godotClassName: StringName
Instance members
var interfaceAdded: Signal1
Emitted when a new interface has been added.
var interfaceRemoved: Signal2
Emitted when an interface is removed.
var trackerAdded: Signal3
Emitted when a new tracker has been added. If you don’t use a fixed number of controllers or if you’re using
XRAnchor3D
s for an AR solution, it is important to react to this signal to add the appropriateXRController3D
orXRAnchor3D
nodes related to this new tracker.var trackerRemoved: Signal5
Emitted when a tracker is removed. You should remove any
XRController3D
orXRAnchor3D
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).var trackerUpdated: Signal4
Emitted when an existing tracker has been updated. This can happen if the user switches controllers.
Citizens in SwiftGodot
Instance members
var emitted: Void
You can await this property to wait for the signal to be emitted once
func connect(flags: Object.ConnectFlags, @escaping (_ trackerName: StringName, _ type: Int64) -> ()
) -> Object Connects the signal to the specified callback
func disconnect(Object
) Disconnects a signal that was previously connected, the return value from calling
connect(flags:_:)