XRPositionalTracker
A tracked object.
XRPositionalTracker.swift:27class XRPositionalTracker
An instance of this object represents a device that is tracked, such as a controller or anchor point. HMDs aren’t represented here as they are handled internally.
As controllers are turned on and the XRInterface
detects them, instances of this object are automatically added to this list of active tracking objects accessible through the XRServer
.
The XRController3D
and XRAnchor3D
both consume objects of this type and should be used in your project. The positional trackers are just under-the-hood objects that make this all work. These are mostly exposed so that GDExtension-based interfaces can interact with them.
This object emits the following signals:
Superclasses
class RefCounted
Base class for reference-counted objects.
Citizens in SwiftGodot
Conformances
protocol CustomStringConvertible
A type with a customized textual representation.
protocol Equatable
A type that can be compared for value equality.
protocol Hashable
A type that can be hashed into a
Hasher
to produce an integer hash value.protocol Identifiable<ID>
A class of types whose instances hold the value of an entity with stable identity.
protocol VariantRepresentable
Types that conform to VariantRepresentable can be stored directly in
Variant
with no conversion. These include all of the Variant types from Godot (for exampleGString
,Rect
,Plane
), Godot objects (those that subclass SwiftGodot.Object) as well as the built-in Swift types UInt8, Int64 and Double.protocol VariantStorable
Types that conform to VariantStorable can be stored in a Variant and can be extracted back out of a Variant.
Types
class Signal1
Signal support.
class Signal2
Signal support.
class Signal3
Signal support.
class Signal4
Signal support.
class Signal5
Signal support.
class Signal6
Signal support.
class Signal7
Signal support.
enum TrackerHand
Type members
Instance members
var additionalDescription: String
The description of this tracker.
var hand: XRPositionalTracker.TrackerHand
Defines which hand this tracker relates to.
var inputFloatChanged: Signal5
Emitted when a trigger or similar input on this tracker changes value.
var inputVector2Changed: Signal6
Emitted when a thumbstick or thumbpad on this tracker moves.
var name: StringName
The unique name of this tracker. The trackers that are available differ between various XR runtimes and can often be configured by the user. Godot maintains a number of reserved names that it expects the
XRInterface
to implement if applicable:var poseChanged: Signal1
Emitted when the state of a pose tracked by this tracker changes.
var poseLostTracking: Signal2
Emitted when a pose tracked by this tracker stops getting updated tracking data.
var profile: String
The profile associated with this tracker, interface dependent but will indicate the type of controller being tracked.
var profileChanged: Signal7
Emitted when the profile of our tracker changes.
var type: XRServer.TrackerType
The type of tracker.
func getInput(name: StringName
) -> Variant Returns an input for this tracker. It can return a boolean, float or
Vector2
value depending on whether the input is a button, trigger or thumbstick/thumbpad.func getPose(name: StringName
) -> XRPose? Returns the current
XRPose
state object for the boundname
pose.func hasPose(name: StringName
) -> Bool Returns
true
if the tracker is available and is currently tracking the boundname
pose.func invalidatePose(name: StringName
) Marks this pose as invalid, we don’t clear the last reported state but it allows users to decide if trackers need to be hidden if we lose tracking or just remain at their last known position.
func setInput(name: StringName, value: Variant
) Changes the value for the given input. This method is called by a
XRInterface
implementation and should not be used directly.func setPose(name: StringName, transform: Transform3D, linearVelocity: Vector3, angularVelocity: Vector3, trackingConfidence: XRPose.TrackingConfidence
) Sets the transform, linear velocity, angular velocity and tracking confidence for the given pose. This method is called by a
XRInterface
implementation and should not be used directly.