SteamVRDeviceLifecycle
A class in Root.Township, the global namespace.
Device lifecycle for SteamVR: listens to SteamVR events for new poses and controllers connecting or changing role. Client only.
- Listed in Global namespace: S
- Inherits or implements
VirtualRealityDeviceLifecycle
Constructors
| Member | What it is |
|---|---|
SteamVRDeviceLifecycle(IPlatformPlayer player, IPlatformDevice platformDevice) | Creates a SteamVRDeviceLifecycle from player and platformDevice. |
Fields
4 private and internal fields
| Member | What it is |
|---|---|
private SteamVR_Events.Action deviceRoleChanged | SteamVR system event action for device role changes. |
private List<SteamVRPose> foundControllers | Connected controller poses. |
private static Logger logger | NLog logger for assignment warnings. |
private List<SteamVRPose> poses | One SteamVRPose per tracked device index, created on demand. |
Methods
| Member | What it is |
|---|---|
override void DisableSDK() | Removes all SteamVR event listeners. |
override void EnableSDK() | Registers already connected devices and subscribes to SteamVR pose, focus, connection and role-change events. |
protected override void OnPlatformPlayerSet(IPlatformPlayer oldPlayer, IPlatformPlayer newPlayer) | Reassigns controllers when the platform player changes. |
7 private and internal methods
| Member | What it is |
|---|---|
private void AssignControllers() | Looks up the left and right hand device indices and tries to assign them to the player's hands. |
private bool AttemptAssignDevice(PosedObject posedObject, SteamVR_TrackedObject.EIndex device) | Returns true if the device's pose exists and isn't reserved, otherwise logs a warning. It doesn't assign anything itself. |
private SteamVRPose GetPose(SteamVR_TrackedObject.EIndex index) | Returns the SteamVRPose for a device index, creating poses up to it and enabling it. Null for None. |
private void OnDeviceConnected(int deviceIndex, bool isConnected) | Tracks controllers connecting or disconnecting and reassigns hands. |
private void OnInputFocus(bool isShowingDashboard) | Does nothing. |
private void OnNewPoses(TrackedDevicePose_t[] devicePoses) | Passes new SteamVR poses to each enabled SteamVRPose. |
private void OnTrackedDeviceRoleChanged(VREvent_t args) | Reassigns controllers when SteamVR changes a device's hand role. |