OpenXRInputController
An abstract class in Root.Township, the global namespace.
Client: reads one hand's controller through OpenXR and fills the game's controller input, including velocity, finger curl and pose.
- Listed in Global namespace: M to O
- Inherits or implements
DeviceInputController - Derived types
BaseOpenXRInputController,GenericOpenXRInputController,PlayingOpenXRInputController
Constructors
| Member | What it is |
|---|---|
OpenXRInputController(PlayerInput controller) | Creates an OpenXRInputController from controller. |
Fields
| Member | What it is |
|---|---|
protected static readonly InputMap inputMap | Shared input map for OpenXR controllers. |
protected static readonly OpenXRWrapper openXRWrapper | Shared wrapper that holds the left and right OpenXR inputs. |
9 private and internal fields
| Member | What it is |
|---|---|
private Vector3 angularVelocity | Angular velocity from UpdateAngularVelocity, passed into the input's velocities. |
private const float AngularVelocityThreshold | If the frame's rotation change has a w above this, angular velocity is treated as zero. |
private InputDeviceCharacteristics deviceCharacteristics | Left or right device characteristics for this hand. |
private static List<InputDevice> devices | Shared scratch list of input devices. |
private bool isRightHand | True when this controller is for the right hand. |
private const float LerpSpeed | Seconds it takes the finger skeleton values to move fully towards their target. |
private static Logger logger | NLog logger for this class. |
private OpenXRControllerInput openXRInput | The hand's input state from the shared OpenXRWrapper. |
private Quaternion previousRotation | Hand rotation from the previous frame, used for angular velocity. |
Properties
| Member | What it is |
|---|---|
protected override ControllerInput Input { get; } | This hand's OpenXR controller input. |
1 private and internal property
Methods
| Member | What it is |
|---|---|
override void TriggerHaptics(float strength, float frequency, float remainingTime) | Sends a vibration of the given strength and time to this hand's controller. |
override void UpdatePosition() | Moves the hand target to the tracked controller pose, adjusted by the player height fix. |
protected override void PopulateInput(ControllerInput input) | Fills the input each frame: velocities, finger skeleton from touch and grip, swipe and photo button. |
2 private and internal methods
| Member | What it is |
|---|---|
private void LerpTouchSkeleton(ControllerInput input, int index, bool isTouching, float axis, float lerp) | Moves one finger's skeleton value towards its target, which depends on whether it's touching and the axis value. |
private void UpdateAngularVelocity() | Works out the hand's angular velocity from its rotation change since last frame, relative to the player's rotation. |