TBTracking
A static wrapper class for interfacing with tracking systems across all platforms.
Overview
TBTracking
sets up tracking nodes for all of the devices needed by your game at runtime, and lets you attach / detach objects from those nodes.
Dependencies
- At least one platform is enabled in the Core Settings menu
- The scene contains a
TBCore
object - At least one tracked input type is enabled in the Input Settings menu
Reference
Get the TButt and UnityEngine.XR namespaces to reference TBTracking
in your scripts.
using TButt;
using UnityEngine.XR;
Getting Nodes
You can get a reference to any node’s transform with the following function:
Transform GetTransformForNode(XRNode node)
The supported nodes are as follows:
Node | Device |
---|---|
XRNode.CenterEye |
Camera |
XRNode.LeftHand |
Left hand controller |
XRNode.RightHand |
Right hand controller |
XRNode.GameController |
3DOF controller or tracked gamepad |
Attaching to Nodes
Use the included TBTrackedNodeHelper script, or manually attach your objects to tracking nodes at runtime.
3DOF Arm Model
The 3DOF arm model (accessible via TB3DOFArmModel.instance
) offers some features specific to that node type:
Function | Description |
---|---|
void ToggleCenteredAlignment(bool on) |
Toggles “centered” or left / right handedness alignnment. |
Transform GetPointerSourceTransform() |
Gets the pointer transform, which may have a different alignment from the hand transform (for raycasting). |
Transform GetHandTransform() |
Gets the hand transform for the arm model. |
Events
You can get events when nodes are connected:
Event | Description |
---|---|
TBTracking.OnNodeConnected(XRNode node, Transform t) |
Receives the newly connected node and the transform associated with it. |