Add ultimate xr
This commit is contained in:
@@ -0,0 +1,24 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="UxrMetaHandTracking.FlipMode.cs" company="VRMADA">
|
||||
// Copyright (c) VRMADA, All rights reserved.
|
||||
// </copyright>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
namespace UltimateXR.Devices.Integrations.Meta
|
||||
{
|
||||
public partial class UxrMetaHandTracking
|
||||
{
|
||||
#region Private Types & Data
|
||||
|
||||
/// <summary>
|
||||
/// Enumerates the different ways to retrieve an Oculus SDK Quaternion.
|
||||
/// </summary>
|
||||
private enum FlipMode
|
||||
{
|
||||
None,
|
||||
FlipX,
|
||||
FlipZ
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 42cd7d7680024864810a8c3cf3a42dbc
|
||||
timeCreated: 1654777476
|
||||
@@ -0,0 +1,266 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="UxrMetaHandTracking.cs" company="VRMADA">
|
||||
// Copyright (c) VRMADA, All rights reserved.
|
||||
// </copyright>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
using UltimateXR.Core;
|
||||
#if ULTIMATEXR_USE_OCULUS_SDK
|
||||
using UltimateXR.Avatar.Rig;
|
||||
using UltimateXR.Core.Math;
|
||||
using UltimateXR.Extensions.Unity.Math;
|
||||
using UnityEngine;
|
||||
#endif
|
||||
|
||||
namespace UltimateXR.Devices.Integrations.Meta
|
||||
{
|
||||
/// <summary>
|
||||
/// Hand tracking for Meta devices.
|
||||
/// </summary>
|
||||
public partial class UxrMetaHandTracking : UxrHandTracking
|
||||
{
|
||||
#region Public Overrides UxrTrackingDevice
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string SDKDependency => UxrConstants.SdkOculus;
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Overrides UxrHandTracking
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool IsLeftHandAvailable
|
||||
{
|
||||
get
|
||||
{
|
||||
#if ULTIMATEXR_USE_OCULUS_SDK
|
||||
if (OVRPlugin.GetHandState(OVRPlugin.Step.Render, OVRPlugin.Hand.HandLeft, ref _leftHandState))
|
||||
{
|
||||
_isLeftHandAvailable = _leftHandState.Status.HasFlag(OVRPlugin.HandStatus.HandTracked);
|
||||
}
|
||||
else
|
||||
{
|
||||
_isLeftHandAvailable = false;
|
||||
}
|
||||
return _isLeftHandAvailable;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override bool IsRightHandAvailable
|
||||
{
|
||||
get
|
||||
{
|
||||
#if ULTIMATEXR_USE_OCULUS_SDK
|
||||
if (OVRPlugin.GetHandState(OVRPlugin.Step.Render, OVRPlugin.Hand.HandRight, ref _rightHandState))
|
||||
{
|
||||
_isRightHandAvailable = _rightHandState.Status.HasFlag(OVRPlugin.HandStatus.HandTracked);
|
||||
}
|
||||
else
|
||||
{
|
||||
_isRightHandAvailable = false;
|
||||
}
|
||||
return _isRightHandAvailable;
|
||||
#else
|
||||
return false;
|
||||
#endif
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Unity
|
||||
|
||||
/// <summary>
|
||||
/// Subscribes to events so that the component can be enabled or disabled based on the presence of hand tracking.
|
||||
/// </summary>
|
||||
protected override void Awake()
|
||||
{
|
||||
base.Awake();
|
||||
|
||||
#if ULTIMATEXR_USE_OCULUS_SDK
|
||||
// Initialize axis system
|
||||
|
||||
if (Avatar != null && Avatar.LeftHand.HasFullHandData())
|
||||
{
|
||||
_leftHandOculusRotation = Quaternion.LookRotation(Vector3.right, -Vector3.up);
|
||||
_leftFingerOculusRotation = Quaternion.LookRotation(-Vector3.right, -Vector3.up);
|
||||
}
|
||||
|
||||
if (Avatar != null && Avatar.RightHand.HasFullHandData())
|
||||
{
|
||||
_rightHandOculusRotation = Quaternion.LookRotation(Vector3.right, Vector3.up);
|
||||
_rightFingerOculusRotation = Quaternion.LookRotation(Vector3.right, Vector3.up);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#region Protected Overrides UxrTrackingDevice
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void UpdateSensors()
|
||||
{
|
||||
#if ULTIMATEXR_USE_OCULUS_SDK
|
||||
_isLeftHandAvailable = OVRPlugin.GetHandState(OVRPlugin.Step.Render, OVRPlugin.Hand.HandLeft, ref _leftHandState);
|
||||
_isRightHandAvailable = OVRPlugin.GetHandState(OVRPlugin.Step.Render, OVRPlugin.Hand.HandRight, ref _rightHandState);
|
||||
#endif
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
protected override void UpdateAvatar()
|
||||
{
|
||||
#if ULTIMATEXR_USE_OCULUS_SDK
|
||||
|
||||
Transform wristLeft = Avatar.LeftHandBone;
|
||||
Transform wristRight = Avatar.RightHandBone;
|
||||
|
||||
if (_isLeftHandAvailable && wristLeft != null)
|
||||
{
|
||||
if (UseCalibration)
|
||||
{
|
||||
SetCalibrationPose(UxrHandSide.Left);
|
||||
}
|
||||
|
||||
UxrAvatarArmInfo leftArmInfo = Avatar.AvatarRigInfo.GetArmInfo(UxrHandSide.Left);
|
||||
UxrUniversalLocalAxes leftHandParentAxes = wristLeft.parent == Avatar.AvatarRig.LeftArm.Forearm ? leftArmInfo.ForearmUniversalLocalAxes : leftArmInfo.HandUniversalLocalAxes;
|
||||
|
||||
Vector3 sensorLeftPos = Avatar.transform.TransformPoint(_leftHandState.RootPose.Position.FromFlippedZVector3f());
|
||||
Quaternion sensorLeftRot = Avatar.transform.rotation * ToCorrectCoordinateSystem(_leftHandState.RootPose.Orientation, FlipMode.FlipZ, _leftHandOculusRotation, leftHandParentAxes, leftArmInfo.HandUniversalLocalAxes);
|
||||
|
||||
wristLeft.position = sensorLeftPos;
|
||||
wristLeft.rotation = sensorLeftRot;
|
||||
|
||||
UpdateFinger(UxrHandSide.Left, Avatar.LeftHand.Index, OVRPlugin.BoneId.Hand_Index1, 3, _leftFingerOculusRotation, leftArmInfo.HandUniversalLocalAxes, leftArmInfo.FingerUniversalLocalAxes);
|
||||
UpdateFinger(UxrHandSide.Left, Avatar.LeftHand.Middle, OVRPlugin.BoneId.Hand_Middle1, 3, _leftFingerOculusRotation, leftArmInfo.HandUniversalLocalAxes, leftArmInfo.FingerUniversalLocalAxes);
|
||||
UpdateFinger(UxrHandSide.Left, Avatar.LeftHand.Ring, OVRPlugin.BoneId.Hand_Ring1, 3, _leftFingerOculusRotation, leftArmInfo.HandUniversalLocalAxes, leftArmInfo.FingerUniversalLocalAxes);
|
||||
UpdateFinger(UxrHandSide.Left, Avatar.LeftHand.Little, OVRPlugin.BoneId.Hand_Pinky0, 4, _leftFingerOculusRotation, leftArmInfo.HandUniversalLocalAxes, leftArmInfo.FingerUniversalLocalAxes);
|
||||
UpdateFinger(UxrHandSide.Left, Avatar.LeftHand.Thumb, OVRPlugin.BoneId.Hand_Thumb0, 4, _leftFingerOculusRotation, leftArmInfo.HandUniversalLocalAxes, leftArmInfo.FingerUniversalLocalAxes);
|
||||
}
|
||||
|
||||
if (_isRightHandAvailable && wristRight != null)
|
||||
{
|
||||
if (UseCalibration)
|
||||
{
|
||||
SetCalibrationPose(UxrHandSide.Right);
|
||||
}
|
||||
|
||||
UxrAvatarArmInfo rightArmInfo = Avatar.AvatarRigInfo.GetArmInfo(UxrHandSide.Right);
|
||||
UxrUniversalLocalAxes rightHandParentAxes = wristRight.parent == Avatar.AvatarRig.RightArm.Forearm ? rightArmInfo.ForearmUniversalLocalAxes : rightArmInfo.HandUniversalLocalAxes;
|
||||
|
||||
Vector3 sensorRightPos = Avatar.transform.TransformPoint(_rightHandState.RootPose.Position.FromFlippedZVector3f());
|
||||
Quaternion sensorRightRot = Avatar.transform.rotation * ToCorrectCoordinateSystem(_rightHandState.RootPose.Orientation, FlipMode.FlipZ, _rightHandOculusRotation, rightHandParentAxes, rightArmInfo.HandUniversalLocalAxes);
|
||||
|
||||
wristRight.position = sensorRightPos;
|
||||
wristRight.rotation = sensorRightRot;
|
||||
|
||||
UpdateFinger(UxrHandSide.Right, Avatar.RightHand.Index, OVRPlugin.BoneId.Hand_Index1, 3, _rightFingerOculusRotation, rightArmInfo.HandUniversalLocalAxes, rightArmInfo.FingerUniversalLocalAxes);
|
||||
UpdateFinger(UxrHandSide.Right, Avatar.RightHand.Middle, OVRPlugin.BoneId.Hand_Middle1, 3, _rightFingerOculusRotation, rightArmInfo.HandUniversalLocalAxes, rightArmInfo.FingerUniversalLocalAxes);
|
||||
UpdateFinger(UxrHandSide.Right, Avatar.RightHand.Ring, OVRPlugin.BoneId.Hand_Ring1, 3, _rightFingerOculusRotation, rightArmInfo.HandUniversalLocalAxes, rightArmInfo.FingerUniversalLocalAxes);
|
||||
UpdateFinger(UxrHandSide.Right, Avatar.RightHand.Little, OVRPlugin.BoneId.Hand_Pinky1, 3, _rightFingerOculusRotation, rightArmInfo.HandUniversalLocalAxes, rightArmInfo.FingerUniversalLocalAxes);
|
||||
UpdateFinger(UxrHandSide.Right, Avatar.RightHand.Thumb, OVRPlugin.BoneId.Hand_Thumb0, 4, _rightFingerOculusRotation, rightArmInfo.HandUniversalLocalAxes, rightArmInfo.FingerUniversalLocalAxes);
|
||||
}
|
||||
|
||||
#endif
|
||||
}
|
||||
|
||||
#endregion
|
||||
|
||||
#if ULTIMATEXR_USE_OCULUS_SDK
|
||||
|
||||
/// <summary>
|
||||
/// Updates a finger using tracking information.
|
||||
/// </summary>
|
||||
/// <param name="handSide">Which hand the finger belongs to</param>
|
||||
/// <param name="avatarFinger">The avatar finger to update</param>
|
||||
/// <param name="baseBoneId">The oculus bone base id</param>
|
||||
/// <param name="boneCount">The number of bones to update, usually 2, 3 or 4</param>
|
||||
/// <param name="fingerOculusRotation">Oculus finger coordinate system</param>
|
||||
/// <param name="wristUniversalLocalAxes">Avatar wrist coordinate system</param>
|
||||
/// <param name="fingerUniversalLocalAxes">Avatar finger coordinate system</param>
|
||||
private void UpdateFinger(UxrHandSide handSide, UxrAvatarFinger avatarFinger, OVRPlugin.BoneId baseBoneId, int boneCount, Quaternion fingerOculusRotation, UxrUniversalLocalAxes wristUniversalLocalAxes, UxrUniversalLocalAxes fingerUniversalLocalAxes)
|
||||
{
|
||||
int baseIndex = (int)baseBoneId;
|
||||
|
||||
OVRPlugin.HandState handState = handSide == UxrHandSide.Left ? _leftHandState : _rightHandState;
|
||||
FlipMode flipMode = handSide == UxrHandSide.Left ? FlipMode.FlipX : FlipMode.FlipZ;
|
||||
|
||||
if (boneCount > 3)
|
||||
{
|
||||
if (avatarFinger.Metacarpal != null)
|
||||
{
|
||||
avatarFinger.Metacarpal.localRotation = ToCorrectCoordinateSystem(handState.BoneRotations[baseIndex], flipMode, fingerOculusRotation, wristUniversalLocalAxes, fingerUniversalLocalAxes);
|
||||
ApplyBoneCalibration(avatarFinger.Metacarpal);
|
||||
}
|
||||
|
||||
baseIndex++;
|
||||
}
|
||||
|
||||
if (boneCount > 2)
|
||||
{
|
||||
avatarFinger.Proximal.localRotation = ToCorrectCoordinateSystem(handState.BoneRotations[baseIndex], flipMode, fingerOculusRotation, avatarFinger.Metacarpal == null ? wristUniversalLocalAxes : fingerUniversalLocalAxes, fingerUniversalLocalAxes);
|
||||
ApplyBoneCalibration(avatarFinger.Proximal);
|
||||
|
||||
baseIndex++;
|
||||
}
|
||||
|
||||
avatarFinger.Intermediate.localRotation = ToCorrectCoordinateSystem(handState.BoneRotations[baseIndex], flipMode, fingerOculusRotation, fingerUniversalLocalAxes, fingerUniversalLocalAxes);
|
||||
avatarFinger.Distal.localRotation = ToCorrectCoordinateSystem(handState.BoneRotations[baseIndex + 1], flipMode, fingerOculusRotation, fingerUniversalLocalAxes, fingerUniversalLocalAxes);
|
||||
|
||||
ApplyBoneCalibration(avatarFinger.Intermediate);
|
||||
ApplyBoneCalibration(avatarFinger.Distal);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
/// Converts a rotation from the Oculus SDK coordinate system to the avatar coordinate system.
|
||||
/// </summary>
|
||||
/// <param name="oculusRotation">Oculus rotation to convert</param>
|
||||
/// <param name="flipRotation">How to process the rotation</param>
|
||||
/// <param name="oculusAxes">
|
||||
/// Information that converts from the "universal" coordinate system to the coordinate
|
||||
/// system used by the parent's node.
|
||||
/// </param>
|
||||
/// <param name="parentUniversalLocalAxes"></param>
|
||||
/// <param name="universalLocalAxes">
|
||||
/// Information that converts from the "universal" coordinate system to the coordinate
|
||||
/// system used by the node.
|
||||
/// </param>
|
||||
/// <returns>Rotation in the avatar coordinate system</returns>
|
||||
private Quaternion ToCorrectCoordinateSystem(OVRPlugin.Quatf oculusRotation, FlipMode flipRotation, Quaternion oculusAxes, UxrUniversalLocalAxes parentUniversalLocalAxes, UxrUniversalLocalAxes universalLocalAxes)
|
||||
{
|
||||
Quaternion rotation = oculusRotation.FromQuatf();
|
||||
|
||||
switch (flipRotation)
|
||||
{
|
||||
case FlipMode.FlipX:
|
||||
rotation = oculusRotation.FromFlippedXQuatf();
|
||||
break;
|
||||
|
||||
case FlipMode.FlipZ:
|
||||
rotation = oculusRotation.FromFlippedZQuatf();
|
||||
break;
|
||||
}
|
||||
|
||||
Quaternion finalRotation = Quaternion.Inverse(parentUniversalLocalAxes.UniversalToActualAxesRotation) * universalLocalAxes.UniversalToActualAxesRotation * rotation * Quaternion.Inverse(oculusAxes) * universalLocalAxes.UniversalToActualAxesRotation;
|
||||
return finalRotation.IsValid() ? finalRotation : Quaternion.identity;
|
||||
}
|
||||
|
||||
#endif
|
||||
|
||||
#if ULTIMATEXR_USE_OCULUS_SDK
|
||||
|
||||
private bool _isLeftHandAvailable;
|
||||
private bool _isRightHandAvailable;
|
||||
private OVRPlugin.HandState _leftHandState;
|
||||
private OVRPlugin.HandState _rightHandState;
|
||||
private Quaternion _leftHandOculusRotation;
|
||||
private Quaternion _rightHandOculusRotation;
|
||||
private Quaternion _leftFingerOculusRotation;
|
||||
private Quaternion _rightFingerOculusRotation;
|
||||
|
||||
#endif
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 5d33e531453e48da93053497271b4abd
|
||||
timeCreated: 1654764133
|
||||
@@ -0,0 +1,72 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="UxrMetaTouchQuest2Input.cs" company="VRMADA">
|
||||
// Copyright (c) VRMADA, All rights reserved.
|
||||
// </copyright>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
using System.Collections.Generic;
|
||||
using UltimateXR.Core;
|
||||
|
||||
namespace UltimateXR.Devices.Integrations.Meta
|
||||
{
|
||||
/// <summary>
|
||||
/// Oculus Touch controller input using Oculus SDK.
|
||||
/// </summary>
|
||||
public class UxrMetaTouchQuest2Input : UxrUnityXRControllerInput
|
||||
{
|
||||
#region Public Overrides UxrControllerInput
|
||||
|
||||
/// <summary>
|
||||
/// Gets the SDK dependency: Oculus SDK.
|
||||
/// </summary>
|
||||
public override string SDKDependency => UxrConstants.SdkOculus;
|
||||
|
||||
/// <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.ThumbCapSense |
|
||||
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
|
||||
{
|
||||
if (UxrTrackingDevice.HeadsetDeviceName is "Oculus Quest2")
|
||||
{
|
||||
yield return "Oculus Touch Controller - Left";
|
||||
yield return "Oculus Touch Controller - Right";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 4ff66b86132a55f4a9f6efea46da64bb
|
||||
timeCreated: 1499677449
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,65 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="UxrMetaTouchQuest2InputSteamVR.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.Meta
|
||||
{
|
||||
/// <summary>
|
||||
/// Oculus Touch controllers input using SteamVR.
|
||||
/// </summary>
|
||||
public class UxrMetaTouchQuest2InputSteamVR : UxrSteamVRControllerInput
|
||||
{
|
||||
#region Public Overrides UxrSteamVRControllerInput
|
||||
|
||||
/// <inheritdoc />
|
||||
public override IEnumerable<string> ControllerNames
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return "Oculus Quest2 (Left Controller)";
|
||||
yield return "Oculus Quest2 (Right Controller)";
|
||||
}
|
||||
}
|
||||
|
||||
#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.Trigger | // Trigger
|
||||
UxrControllerElements.Button1 | // Button A
|
||||
UxrControllerElements.Button2 | // Button B
|
||||
UxrControllerElements.DPad);
|
||||
|
||||
if (handSide == UxrHandSide.Left)
|
||||
{
|
||||
validElements |= (uint)UxrControllerElements.Menu;
|
||||
}
|
||||
|
||||
return (validElements & (uint)controllerElements) == (uint)controllerElements;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override UxrControllerInputCapabilities GetControllerCapabilities(UxrHandSide handSide)
|
||||
{
|
||||
return UxrControllerInputCapabilities.HapticImpulses;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: e34315eb5a4f11d41ade48a0c1a86715
|
||||
timeCreated: 1499677449
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,30 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="UxrMetaTouchQuest2Tracking.cs" company="VRMADA">
|
||||
// Copyright (c) VRMADA, All rights reserved.
|
||||
// </copyright>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
using System;
|
||||
using UltimateXR.Core;
|
||||
|
||||
namespace UltimateXR.Devices.Integrations.Meta
|
||||
{
|
||||
/// <summary>
|
||||
/// Tracking for Oculus Touch devices using the Oculus SDK.
|
||||
/// </summary>
|
||||
public class UxrMetaTouchQuest2Tracking : UxrUnityXRControllerTracking
|
||||
{
|
||||
#region Public Overrides UxrControllerTracking
|
||||
|
||||
/// <inheritdoc />
|
||||
public override Type RelatedControllerInputType => typeof(UxrMetaTouchQuest2Input);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Overrides UxrTrackingDevice
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string SDKDependency => UxrConstants.SdkOculus;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 793d8fce02a8c7a42a9414fb6f5d3dc1
|
||||
timeCreated: 1499842642
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,23 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="UxrMetaTouchQuest2TrackingSteamVR.cs" company="VRMADA">
|
||||
// Copyright (c) VRMADA, All rights reserved.
|
||||
// </copyright>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
using System;
|
||||
using UltimateXR.Devices.Integrations.SteamVR;
|
||||
|
||||
namespace UltimateXR.Devices.Integrations.Meta
|
||||
{
|
||||
/// <summary>
|
||||
/// Tracking for Oculus Touch controllers using SteamVR SDK.
|
||||
/// </summary>
|
||||
public class UxrMetaTouchQuest2TrackingSteamVR : UxrSteamVRControllerTracking
|
||||
{
|
||||
#region Public Overrides UxrControllerTracking
|
||||
|
||||
/// <inheritdoc />
|
||||
public override Type RelatedControllerInputType => typeof(UxrMetaTouchQuest2InputSteamVR);
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 813e0bb28152bed4ea5c634099e04934
|
||||
timeCreated: 1624443263
|
||||
@@ -0,0 +1,72 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="UxrMetaTouchQuest3Input.cs" company="VRMADA">
|
||||
// Copyright (c) VRMADA, All rights reserved.
|
||||
// </copyright>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
using System.Collections.Generic;
|
||||
using UltimateXR.Core;
|
||||
|
||||
namespace UltimateXR.Devices.Integrations.Meta
|
||||
{
|
||||
/// <summary>
|
||||
/// Oculus Touch controller input using Oculus SDK.
|
||||
/// </summary>
|
||||
public class UxrMetaTouchQuest3Input : UxrUnityXRControllerInput
|
||||
{
|
||||
#region Public Overrides UxrControllerInput
|
||||
|
||||
/// <summary>
|
||||
/// Gets the SDK dependency: Oculus SDK.
|
||||
/// </summary>
|
||||
public override string SDKDependency => UxrConstants.SdkOculus;
|
||||
|
||||
/// <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.ThumbCapSense |
|
||||
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
|
||||
{
|
||||
if (UxrTrackingDevice.HeadsetDeviceName is "Oculus Quest3" or "Meta Quest 3" or "Oculus Headset2")
|
||||
{
|
||||
yield return "Oculus Touch Controller - Left";
|
||||
yield return "Oculus Touch Controller - Right";
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: fd07cb58266720f478deb9264c45c614
|
||||
timeCreated: 1499677449
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,67 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="UxrMetaTouchQuest3InputSteamVR.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.Meta
|
||||
{
|
||||
/// <summary>
|
||||
/// Oculus Touch controllers input using SteamVR.
|
||||
/// </summary>
|
||||
public class UxrMetaTouchQuest3InputSteamVR : UxrSteamVRControllerInput
|
||||
{
|
||||
#region Public Overrides UxrSteamVRControllerInput
|
||||
|
||||
/// <inheritdoc />
|
||||
public override IEnumerable<string> ControllerNames
|
||||
{
|
||||
get
|
||||
{
|
||||
yield return "Oculus Quest3 (Left Controller)";
|
||||
yield return "Oculus Quest3 (Right Controller)";
|
||||
yield return "Meta Quest 3 (Left Controller)";
|
||||
yield return "Meta Quest 3 (Right Controller)";
|
||||
}
|
||||
}
|
||||
|
||||
#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.Trigger | // Trigger
|
||||
UxrControllerElements.Button1 | // Button A
|
||||
UxrControllerElements.Button2 | // Button B
|
||||
UxrControllerElements.DPad);
|
||||
|
||||
if (handSide == UxrHandSide.Left)
|
||||
{
|
||||
validElements |= (uint)UxrControllerElements.Menu;
|
||||
}
|
||||
|
||||
return (validElements & (uint)controllerElements) == (uint)controllerElements;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override UxrControllerInputCapabilities GetControllerCapabilities(UxrHandSide handSide)
|
||||
{
|
||||
return UxrControllerInputCapabilities.HapticImpulses;
|
||||
}
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: a0acc555071f36c4fb74251d9a25c5ae
|
||||
timeCreated: 1499677449
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,30 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="UxrMetaTouchQuest3Tracking.cs" company="VRMADA">
|
||||
// Copyright (c) VRMADA, All rights reserved.
|
||||
// </copyright>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
using System;
|
||||
using UltimateXR.Core;
|
||||
|
||||
namespace UltimateXR.Devices.Integrations.Meta
|
||||
{
|
||||
/// <summary>
|
||||
/// Tracking for Oculus Touch devices using the Oculus SDK.
|
||||
/// </summary>
|
||||
public class UxrMetaTouchQuest3Tracking : UxrUnityXRControllerTracking
|
||||
{
|
||||
#region Public Overrides UxrControllerTracking
|
||||
|
||||
/// <inheritdoc />
|
||||
public override Type RelatedControllerInputType => typeof(UxrMetaTouchQuest3Input);
|
||||
|
||||
#endregion
|
||||
|
||||
#region Public Overrides UxrTrackingDevice
|
||||
|
||||
/// <inheritdoc />
|
||||
public override string SDKDependency => UxrConstants.SdkOculus;
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,12 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 6cc855f608e72a745b7a79e8ca93ba67
|
||||
timeCreated: 1499842642
|
||||
licenseType: Pro
|
||||
MonoImporter:
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
@@ -0,0 +1,23 @@
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
// <copyright file="UxrMetaTouchQuest3TrackingSteamVR.cs" company="VRMADA">
|
||||
// Copyright (c) VRMADA, All rights reserved.
|
||||
// </copyright>
|
||||
// --------------------------------------------------------------------------------------------------------------------
|
||||
using System;
|
||||
using UltimateXR.Devices.Integrations.SteamVR;
|
||||
|
||||
namespace UltimateXR.Devices.Integrations.Meta
|
||||
{
|
||||
/// <summary>
|
||||
/// Tracking for Oculus Touch controllers using SteamVR SDK.
|
||||
/// </summary>
|
||||
public class UxrMetaTouchQuest3TrackingSteamVR : UxrSteamVRControllerTracking
|
||||
{
|
||||
#region Public Overrides UxrControllerTracking
|
||||
|
||||
/// <inheritdoc />
|
||||
public override Type RelatedControllerInputType => typeof(UxrMetaTouchQuest3InputSteamVR);
|
||||
|
||||
#endregion
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,3 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 07ea441b9add1fd4fb72713dd14725cb
|
||||
timeCreated: 1624443263
|
||||
Reference in New Issue
Block a user