|
4 | 4 | using Microsoft.MixedReality.Toolkit.Internal.Definitions.Devices; |
5 | 5 | using Microsoft.MixedReality.Toolkit.Internal.Definitions.Utilities; |
6 | 6 | using Microsoft.MixedReality.Toolkit.Internal.Interfaces.InputSystem; |
| 7 | +using Microsoft.MixedReality.Toolkit.Internal.Utilities; |
7 | 8 |
|
8 | 9 | namespace Microsoft.MixedReality.Toolkit.Internal.Devices.OpenVR |
9 | 10 | { |
10 | 11 | // TODO - Implement |
11 | | - public class OculusTouchController : BaseController |
| 12 | + public class OculusTouchController : GenericOpenVRController |
12 | 13 | { |
13 | 14 | public OculusTouchController(TrackingState trackingState, Handedness controllerHandedness, IMixedRealityInputSource inputSource, MixedRealityInteractionMapping[] interactions) |
14 | 15 | : base(trackingState, controllerHandedness, inputSource, interactions) { } |
| 16 | + |
| 17 | + #region Base override configuration |
| 18 | + |
| 19 | + private InputMappingAxisUtility.InputManagerAxis[] OcculusTouchControllerAxisMappings; |
| 20 | + |
| 21 | + public override InputMappingAxisUtility.InputManagerAxis[] ControllerAxisMappings => OcculusTouchControllerAxisMappings; |
| 22 | + |
| 23 | + /// <summary> |
| 24 | + /// Collection of input mapping constants, grouped in a single class for easier referencing. |
| 25 | + /// </summary> |
| 26 | + /// <remarks> |
| 27 | + /// Uses a fixed index array for controller input in the base / Generic class, as indicated in the array comments</remarks> |
| 28 | + private string[] OcculusTouchInputMappings = |
| 29 | + { |
| 30 | + "OTOUCH_TOUCHPAD_LEFT_CONTROLLER_HORIZONTAL", // 0 - TOUCHPAD_LEFT_CONTROLLER_HORIZONTAL |
| 31 | + "OTOUCH_TOUCHPAD_LEFT_CONTROLLER_VERTICAL", // 1 - TOUCHPAD_LEFT_CONTROLLER_VERTICAL |
| 32 | + "OTOUCH_TOUCHPAD_RIGHT_CONTROLLER_HORIZONTAL", // 2 - TOUCHPAD_RIGHT_CONTROLLER_HORIZONTAL |
| 33 | + "OTOUCH_TOUCHPAD_RIGHT_CONTROLLER_VERTICAL", // 3 - TOUCHPAD_RIGHT_CONTROLLER_VERTICAL |
| 34 | + "OTOUCH_TOUCHPAD_LEFT_CONTROLLER_HORIZONTAL", // 4 - THUMBSTICK_LEFT_CONTROLLER_HORIZONTAL |
| 35 | + "OTOUCH_TOUCHPAD_LEFT_CONTROLLER_VERTICAL", // 5 - THUMBSTICK_LEFT_CONTROLLER_VERTICAL |
| 36 | + "OTOUCH_TOUCHPAD_RIGHT_CONTROLLER_HORIZONTAL", // 6 - THUMBSTICK_RIGHT_CONTROLLER_HORIZONTAL |
| 37 | + "OTOUCH_TOUCHPAD_RIGHT_CONTROLLER_VERTICAL", // 7 - THUMBSTICK_RIGHT_CONTROLLER_VERTICAL |
| 38 | + "OTOUCH_TRIGGER_LEFT_CONTROLLER", // 8 - TRIGGER_LEFT_CONTROLLER |
| 39 | + "OTOUCH_TRIGGER_RIGHT_CONTROLLER", // 9 - TRIGGER_RIGHT_CONTROLLER |
| 40 | + "OTOUCH_GRIP_LEFT_CONTROLLER", // 10 - GRIP_LEFT_CONTROLLER |
| 41 | + "OTOUCH_GRIP_RIGHT_CONTROLLER" // 11 - GRIP_RIGHT_CONTROLLER |
| 42 | + }; |
| 43 | + |
| 44 | + public override string[] VRInputMappings => OcculusTouchInputMappings; |
| 45 | + |
| 46 | + public override void Initialise() |
| 47 | + { |
| 48 | + OcculusTouchControllerAxisMappings = new InputMappingAxisUtility.InputManagerAxis[] |
| 49 | + { |
| 50 | + new InputMappingAxisUtility.InputManagerAxis() { Name = VRInputMappings[0], Dead = 0.001f, Sensitivity = 1, Invert = false, Type = InputMappingAxisUtility.MappingAxisType.JoystickAxis, Axis = 1 }, |
| 51 | + new InputMappingAxisUtility.InputManagerAxis() { Name = VRInputMappings[1], Dead = 0.001f, Sensitivity = 1, Invert = false, Type = InputMappingAxisUtility.MappingAxisType.JoystickAxis, Axis = 2 }, |
| 52 | + new InputMappingAxisUtility.InputManagerAxis() { Name = VRInputMappings[2], Dead = 0.001f, Sensitivity = 1, Invert = false, Type = InputMappingAxisUtility.MappingAxisType.JoystickAxis, Axis = 4 }, |
| 53 | + new InputMappingAxisUtility.InputManagerAxis() { Name = VRInputMappings[3], Dead = 0.001f, Sensitivity = 1, Invert = false, Type = InputMappingAxisUtility.MappingAxisType.JoystickAxis, Axis = 5 }, |
| 54 | + new InputMappingAxisUtility.InputManagerAxis() { Name = VRInputMappings[8], Dead = 0.001f, Sensitivity = 1, Invert = false, Type = InputMappingAxisUtility.MappingAxisType.JoystickAxis, Axis = 9 }, |
| 55 | + new InputMappingAxisUtility.InputManagerAxis() { Name = VRInputMappings[9], Dead = 0.001f, Sensitivity = 1, Invert = false, Type = InputMappingAxisUtility.MappingAxisType.JoystickAxis, Axis = 10 }, |
| 56 | + new InputMappingAxisUtility.InputManagerAxis() { Name = VRInputMappings[10], Dead = 0.001f, Sensitivity = 1, Invert = false, Type = InputMappingAxisUtility.MappingAxisType.JoystickAxis, Axis = 11 }, |
| 57 | + new InputMappingAxisUtility.InputManagerAxis() { Name = VRInputMappings[11], Dead = 0.001f, Sensitivity = 1, Invert = false, Type = InputMappingAxisUtility.MappingAxisType.JoystickAxis, Axis = 12 } |
| 58 | + }; |
| 59 | + } |
| 60 | + |
| 61 | + #endregion Base override configuration |
| 62 | + |
15 | 63 | } |
16 | 64 | } |
0 commit comments