Add ultimate xr
This commit is contained in:
@@ -0,0 +1,63 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="UxrHtcViveCosmosInput.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 Cosmos controllers input using SteamVR.
|
||||
/// </summary>
|
||||
public class UxrHtcViveCosmosInput : UxrSteamVRControllerInput
|
||||
{
|
||||
#region Public Overrides UxrSteamVRControllerInput
|
||||
|
||||
/// <inheritdoc />
|
||||
public override IEnumerable<string> ControllerNames
|
||||
{
|
||||
get { yield return ControllerNameHtcViveCosmos; }
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Overrides UxrControllerInput
|
||||
|
||||
/// <inheritdoc />
|
||||
public override UxrControllerSetupType SetupType => UxrControllerSetupType.Dual;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool MainJoystickIsTouchpad => false;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool HasControllerElements(UxrHandSide handSide, UxrControllerElements controllerElements)
|
||||
{
|
||||
uint validElements = (uint)(UxrControllerElements.Joystick | // Joystick
|
||||
UxrControllerElements.Grip | // Grip
|
||||
UxrControllerElements.Bumper | // Bumper
|
||||
UxrControllerElements.Trigger | // Trigger
|
||||
UxrControllerElements.Button1 | // Button A/X
|
||||
UxrControllerElements.Button2 | // Button B/Y
|
||||
UxrControllerElements.DPad); // Joystick
|
||||
|
||||
return (validElements & (uint)controllerElements) == (uint)controllerElements;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override UxrControllerInputCapabilities GetControllerCapabilities(UxrHandSide handSide)
|
||||
{
|
||||
return UxrControllerInputCapabilities.HapticImpulses;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Private Types & Data
|
||||
|
||||
private const string ControllerNameHtcViveCosmos = "vive_cosmos_controller";
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: aeb548548ec3cdb489de559527782aee
|
||||
timeCreated: 1499677449
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,23 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="UxrHtcViveCosmosTracking.cs" company="VRMADA">
|
||||
// Copyright (c) VRMADA, All rights reserved.
|
||||
// </copyright>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
using System;
|
||||
using UltimateXR.Devices.Integrations.SteamVR;
|
||||
|
||||
namespace UltimateXR.Devices.Integrations.HTC
|
||||
{
|
||||
/// <summary>
|
||||
/// Tracking for HTC Vive Cosmos controllers using SteamVR SDK.
|
||||
/// </summary>
|
||||
public class UxrHtcViveCosmosTracking : UxrSteamVRControllerTracking
|
||||
{
|
||||
#region Public Overrides UxrControllerTracking
|
||||
|
||||
/// <inheritdoc />
|
||||
public override Type RelatedControllerInputType => typeof(UxrHtcViveCosmosInput);
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7aaab42f00bf7ad4bb5388a08c575a4d
|
||||
timeCreated: 1499842642
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,85 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="UxrHtcViveFocus3Input.cs" company="VRMADA">
|
||||
// Copyright (c) VRMADA, All rights reserved.
|
||||
// </copyright>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
using System.Collections.Generic;
|
||||
using UltimateXR.Core;
|
||||
|
||||
namespace UltimateXR.Devices.Integrations.HTC
|
||||
{
|
||||
/// <summary>
|
||||
/// HTC Vive Focus 3 controller input using WaveXR SDK's UnityXR support.
|
||||
/// </summary>
|
||||
public class UxrHtcViveFocus3Input : UxrUnityXRControllerInput
|
||||
{
|
||||
#region Public Overrides UxrControllerInput
|
||||
|
||||
/// <summary>
|
||||
/// Gets the SDK dependency: Wave XR.
|
||||
/// </summary>
|
||||
public override string SDKDependency => UxrConstants.SdkWaveXR;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override UxrControllerSetupType SetupType => UxrControllerSetupType.Dual;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool IsHandednessSupported => true;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool MainJoystickIsTouchpad => false;
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool HasControllerElements(UxrHandSide handSide, UxrControllerElements controllerElements)
|
||||
{
|
||||
uint validElements = (uint)(UxrControllerElements.Joystick |
|
||||
UxrControllerElements.Grip |
|
||||
UxrControllerElements.Trigger |
|
||||
UxrControllerElements.Button1 |
|
||||
UxrControllerElements.Button2 |
|
||||
UxrControllerElements.Menu |
|
||||
UxrControllerElements.DPad);
|
||||
|
||||
if (handSide == UxrHandSide.Right)
|
||||
{
|
||||
// Remove menu button from right controller, which is reserved.
|
||||
validElements = validElements & ~(uint)UxrControllerElements.Menu;
|
||||
}
|
||||
|
||||
return (validElements & (uint)controllerElements) == (uint)controllerElements;
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Overrides UxrUnityXRControllerInput
|
||||
|
||||
/// <inheritdoc />
|
||||
public override IEnumerable<string> ControllerNames
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return "WVR_CR_Left_001";
|
||||
yield return "WVR_CR_Right_001";
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Protected Overrides UxrUnityXRControllerInput
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void UpdateInput()
|
||||
{
|
||||
base.UpdateInput();
|
||||
|
||||
// To avoid grip requiring to press the whole button, we use the analog value and a threshold
|
||||
|
||||
float gripThreshold = 0.7f;
|
||||
|
||||
SetButtonFlags(ButtonFlags.PressFlagsLeft, UxrInputButtons.Grip, GetInput1D(UxrHandSide.Left, UxrInput1D.Grip) > gripThreshold);
|
||||
SetButtonFlags(ButtonFlags.PressFlagsRight, UxrInputButtons.Grip, GetInput1D(UxrHandSide.Right, UxrInput1D.Grip) > gripThreshold);
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 99f34313b313be54fa63910a496c06a7
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,30 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="UxrHtcViveFocus3Tracking.cs" company="VRMADA">
|
||||
// Copyright (c) VRMADA, All rights reserved.
|
||||
// </copyright>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
using System;
|
||||
using UltimateXR.Core;
|
||||
|
||||
namespace UltimateXR.Devices.Integrations.HTC
|
||||
{
|
||||
/// <summary>
|
||||
/// Tracking for HTC Vive Focus 3 controllers using WaveXR SDK's UnityXR support.
|
||||
/// </summary>
|
||||
public class UxrHtcViveFocus3Tracking : UxrUnityXRControllerTracking
|
||||
{
|
||||
#region Public Overrides UxrControllerTracking
|
||||
|
||||
/// <inheritdoc />
|
||||
public override Type RelatedControllerInputType => typeof(UxrHtcViveFocus3Input);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Overrides UxrTrackingDevice
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string SDKDependency => UxrConstants.SdkWaveXR;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 74d5790b838df3441b94784597d32e7a
|
||||
timeCreated: 1499842642
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -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
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 9ab26074711a00449bb89e018281422d
|
||||
timeCreated: 1499677449
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,23 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="UxrHtcViveTracking.cs" company="VRMADA">
|
||||
// Copyright (c) VRMADA, All rights reserved.
|
||||
// </copyright>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
using System;
|
||||
using UltimateXR.Devices.Integrations.SteamVR;
|
||||
|
||||
namespace UltimateXR.Devices.Integrations.HTC
|
||||
{
|
||||
/// <summary>
|
||||
/// Tracking for HTC Vive controllers using SteamVR SDK.
|
||||
/// </summary>
|
||||
public class UxrHtcViveTracking : UxrSteamVRControllerTracking
|
||||
{
|
||||
#region Public Overrides UxrControllerTracking
|
||||
|
||||
/// <inheritdoc />
|
||||
public override Type RelatedControllerInputType => typeof(UxrHtcViveInput);
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: f9f613010cce8f0408243773fe913d9f
|
||||
timeCreated: 1499842642
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
Reference in New Issue
Block a user