Add ultimate xr

This commit is contained in:
2024-08-06 21:58:35 +02:00
parent 864033bf10
commit 7165bacd9d
3952 changed files with 2162037 additions and 35 deletions

View File

@@ -0,0 +1,78 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="UxrHtcViveInput.cs" company="VRMADA">
// Copyright (c) VRMADA, All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
using System.Collections.Generic;
using UltimateXR.Core;
using UltimateXR.Devices.Integrations.SteamVR;
namespace UltimateXR.Devices.Integrations.HTC
{
/// <summary>
/// HTC Vive controllers input using SteamVR.
/// </summary>
public class UxrHtcViveInput : UxrSteamVRControllerInput
{
#region Public Overrides UxrSteamVRControllerInput
/// <inheritdoc />
public override IEnumerable<string> 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";
}
}
/// <inheritdoc />
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
/// <inheritdoc />
public override UxrControllerSetupType SetupType => UxrControllerSetupType.Dual;
/// <inheritdoc />
public override bool MainJoystickIsTouchpad => true;
/// <inheritdoc />
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;
}
/// <inheritdoc />
public override UxrControllerInputCapabilities GetControllerCapabilities(UxrHandSide handSide)
{
return UxrControllerInputCapabilities.HapticImpulses;
}
#endregion
}
}