// -------------------------------------------------------------------------------------------------------------------- // // Copyright (c) VRMADA, All rights reserved. // // -------------------------------------------------------------------------------------------------------------------- using System.Collections.Generic; using UltimateXR.Core; using UltimateXR.Devices.Integrations.SteamVR; namespace UltimateXR.Devices.Integrations.HTC { /// /// HTC Vive controllers input using SteamVR. /// public class UxrHtcViveInput : UxrSteamVRControllerInput { #region Public Overrides UxrSteamVRControllerInput /// public override IEnumerable ControllerNames { get { yield return "controller_vive"; yield return "Vive. Controller MV"; yield return "Vive. Controller Pro MV"; yield return "VIVE Controller MV"; yield return "VIVE Controller Pro MV"; } } /// public override float GetInput1D(UxrHandSide handSide, UxrInput1D input1D, bool getIgnoredInput = false) { // Since Vive controllers don't have an analog grip button, make sure the analog // grip functionality is supported. if (input1D == UxrInput1D.Grip) { return GetButtonsPress(handSide, UxrInputButtons.Grip, getIgnoredInput) ? 1.0f : 0.0f; } return 0.0f; } #endregion #region Public Overrides UxrControllerInput /// public override UxrControllerSetupType SetupType => UxrControllerSetupType.Dual; /// public override bool MainJoystickIsTouchpad => true; /// public override bool HasControllerElements(UxrHandSide handSide, UxrControllerElements controllerElements) { uint validElements = (uint)(UxrControllerElements.Joystick | // Joystick UxrControllerElements.Grip | // Grip UxrControllerElements.Trigger | // Trigger UxrControllerElements.Button1 | // Button A, UxrControllerElements.Button2 | UxrControllerElements.Menu | UxrControllerElements.DPad); // Joystick return (validElements & (uint)controllerElements) == (uint)controllerElements; } /// public override UxrControllerInputCapabilities GetControllerCapabilities(UxrHandSide handSide) { return UxrControllerInputCapabilities.HapticImpulses; } #endregion } }