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,53 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="IUxrAvatarControllerUpdater.cs" company="VRMADA">
// Copyright (c) VRMADA, All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
using UltimateXR.Manipulation;
using UnityEngine;
namespace UltimateXR.Avatar.Controllers
{
/// <summary>
/// Internal interface for avatar controllers to make updating publicly available only from within the framework.
/// Child classes from <see cref="UxrAvatarController" /> will implement these through the protected methods.
/// </summary>
internal interface IUxrAvatarControllerUpdater
{
#region Public Methods
/// <summary>
/// Updates the avatar for the given frame. This is normally in charge of updating input devices, tracking devices and
/// locomotion.
/// Animation is left for a later stage (<see cref="UpdateAvatarAnimation" />), to make sure it is performed in the
/// right order right after Unity has updated the built-in animation components such as <see cref="Animator" />.
/// </summary>
void UpdateAvatar();
/// <summary>
/// Updates the avatar using the current tracking data.
/// </summary>
void UpdateAvatarUsingTrackingDevices();
/// <summary>
/// Updates the avatar manipulation actions based on user input.
/// </summary>
void UpdateAvatarManipulation();
/// <summary>
/// Updates the animation and rig transforms for the given frame. It is performed in a later stage than
/// <see cref="UpdateAvatar" /> to make sure the transforms override the transforms that Unity may have updated using
/// built-in components such as <see cref="Animator" />.
/// </summary>
void UpdateAvatarAnimation();
/// <summary>
/// Updates the avatar for a given frame, at the end of all stages and UltimateXR manager updates such as the
/// <see cref="UxrGrabManager" />. It can be used to perform operations that require to be executed at the end of all
/// stages, such as Inverse Kinematics.
/// </summary>
void UpdateAvatarPostProcess();
#endregion
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: bb702973c8fd0cc48a9313073ec7f4d5
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,43 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="UxrAnimationType.cs" company="VRMADA">
// Copyright (c) VRMADA, All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
namespace UltimateXR.Avatar.Controllers
{
/// <summary>
/// Enumerates the different well-known hand animation types (poses).
/// </summary>
public enum UxrAnimationType
{
/// <summary>
/// Non-relevant left hand pose
/// </summary>
LeftHandOther,
/// <summary>
/// Non-relevant right hand pose
/// </summary>
RightHandOther,
/// <summary>
/// Left hand pose used for grabbing.
/// </summary>
LeftHandGrab,
/// <summary>
/// Right hand pose used for grabbing.
/// </summary>
RightHandGrab,
/// <summary>
/// Left hand pose used for pointing with the finger.
/// </summary>
LeftFingerPoint,
/// <summary>
/// Right hand pose used for pointing with the finger.
/// </summary>
RightFingerPoint
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 318001c1b92249558b000fc871900128
timeCreated: 1642868726

View File

@@ -0,0 +1,216 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="UxrAvatarController.cs" company="VRMADA">
// Copyright (c) VRMADA, All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
using UltimateXR.Core;
using UltimateXR.Core.Components.Composite;
using UltimateXR.Devices;
using UltimateXR.Locomotion;
using UltimateXR.Manipulation;
using UnityEngine;
namespace UltimateXR.Avatar.Controllers
{
/// <summary>
/// Base class for <see cref="UxrAvatar" /> controllers. <see cref="UxrAvatarController" /> components are responsible
/// for updating the avatar. UltimateXR provides the <see cref="UxrStandardAvatarController" /> which has great
/// functionality. For flexibility and scalability, different avatar controllers can be created if required.
/// </summary>
/// <remarks>
/// <see cref="UxrAvatarController" /> components require the <see cref="UxrAvatar" /> component in the same
/// <see cref="GameObject" /> or any of its parents. Only one <see cref="UxrAvatarController" /> component type can
/// be active at the same time.
/// </remarks>
[DisallowMultipleComponent]
[RequireComponent(typeof(UxrAvatar))]
public abstract class UxrAvatarController : UxrAvatarComponent<UxrAvatarController>, IUxrAvatarControllerUpdater
{
#region Inspector Properties/Serialized Fields
[SerializeField] private bool _allowHandTracking = true;
#endregion
#region Public Types & Data
/// <summary>
/// Gets whether the avatar controller finished startup and can be updated.
/// </summary>
public abstract bool Initialized { get; }
/// <summary>
/// Gets whether the avatar is using smooth locomotion. Smooth locomotion updates the position every
/// frame, whereas non-smooth locomotion will move the avatar from one place to another in "jumps".
/// </summary>
public abstract bool UsesSmoothLocomotion { get; }
/// <summary>
/// Gets or sets whether hand tracking is used when available.
/// </summary>
public bool AllowHandTracking
{
get => _allowHandTracking;
set => _allowHandTracking = value;
}
#endregion
#region Explicit IUxrAvatarControllerUpdater
/// <inheritdoc />
void IUxrAvatarControllerUpdater.UpdateAvatar()
{
// Will call the protected method, which is allowed to be overriden by child classes while
// hiding the functionality so that it is handled by the framework in the correct order.
UpdateAvatar();
}
/// <inheritdoc />
void IUxrAvatarControllerUpdater.UpdateAvatarUsingTrackingDevices()
{
UpdateAvatarUsingTrackingDevices();
}
/// <inheritdoc />
void IUxrAvatarControllerUpdater.UpdateAvatarManipulation()
{
// Will call the protected method, which is allowed to be overriden by child classes while
// hiding the functionality so that it is handled by the framework in the correct order.
UpdateAvatarManipulation();
}
/// <inheritdoc />
void IUxrAvatarControllerUpdater.UpdateAvatarAnimation()
{
// Will call the protected method, which is allowed to be overriden by child classes while
// hiding the functionality so that it is handled by the framework in the correct order.
UpdateAvatarAnimation();
}
/// <inheritdoc />
void IUxrAvatarControllerUpdater.UpdateAvatarPostProcess()
{
// Will call the protected method, which is allowed to be overriden by child classes while
// hiding the functionality so that it is handled by the framework in the correct order.
UpdateAvatarPostProcess();
}
#endregion
#region Public Methods
/// <summary>
/// Gets if the hand is available to interact with UI elements, such as pressing buttons. This is used by the UI
/// interaction system to ignore the hand for these events.
/// For example, when the hand is holding an object it could be desirable to not let it interact inadvertently with any
/// user interface.
/// </summary>
/// <param name="handSide">Which hand to check</param>
/// <returns>Whether the given handed can interact with user interfaces</returns>
public virtual bool CanHandInteractWithUI(UxrHandSide handSide)
{
return true;
}
#endregion
#region Protected Methods
/// <summary>
/// Updates the avatar for the given frame. This is normally in charge of updating input devices, tracking devices and
/// locomotion.
/// Animation is left for a later stage (<see cref="UpdateAvatarAnimation" />), to make sure it is performed in the
/// right order right after Unity has updated the built-in animation components such as <see cref="Animator" />.
/// </summary>
protected virtual void UpdateAvatar()
{
}
/// <summary>
/// Executes the avatar manipulation actions based on user input.
/// </summary>
protected virtual void UpdateAvatarManipulation()
{
}
/// <summary>
/// Updates the animation and rig transforms for the given frame. It is performed in a later stage than
/// <see cref="UpdateAvatar" /> to make sure the transforms override the transforms that Unity may have updated using
/// built-in components such as <see cref="Animator" />.
/// </summary>
protected virtual void UpdateAvatarAnimation()
{
}
/// <summary>
/// Updates the avatar for a given frame, at the end of all stages and UltimateXR manager updates such as the
/// <see cref="UxrGrabManager" />. It can be used to perform operations that require to be executed at the end of all
/// stages, such as Inverse Kinematics.
/// </summary>
protected virtual void UpdateAvatarPostProcess()
{
}
/// <summary>
/// Updates the currently enabled input devices.
/// </summary>
protected void UpdateInputDevice()
{
foreach (UxrControllerInput controllerInput in Avatar.EnabledControllerInputs)
{
// Call method using internal interface
((IUxrControllerInputUpdater)controllerInput).UpdateInput();
}
// Refresh render mode
Avatar.RenderMode = Avatar.RenderMode;
}
/// <summary>
/// Updates the tracking devices.
/// </summary>
protected void UpdateTrackingDevices()
{
foreach (UxrTrackingDevice trackingDevice in Avatar.TrackingDevices)
{
if (trackingDevice && trackingDevice.enabled)
{
// Update tracking by calling internal interface
((IUxrTrackingUpdater)trackingDevice).UpdateSensors();
}
}
}
/// <summary>
/// Updates the avatar using the current tracking data.
/// </summary>
protected void UpdateAvatarUsingTrackingDevices()
{
foreach (UxrTrackingDevice trackingDevice in Avatar.TrackingDevices)
{
if (trackingDevice && trackingDevice.enabled)
{
// Update avatar by calling internal interface
((IUxrTrackingUpdater)trackingDevice).UpdateAvatar();
}
}
}
/// <summary>
/// Updates the enabled locomotion components in the avatar.
/// </summary>
protected void UpdateLocomotion()
{
foreach (UxrLocomotion locomotion in UxrLocomotion.GetComponents<UxrLocomotion>(Avatar))
{
if (locomotion.gameObject.activeInHierarchy && locomotion.enabled)
{
((IUxrLocomotionUpdater)locomotion).UpdateLocomotion();
}
}
}
#endregion
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: 013c3c69bff86ce49b3a90666e902653
timeCreated: 1500469656
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,92 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="UxrAvatarControllerEvent.cs" company="VRMADA">
// Copyright (c) VRMADA, All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
using System;
using UltimateXR.Devices;
using UltimateXR.Manipulation.HandPoses;
using UnityEngine;
namespace UltimateXR.Avatar.Controllers
{
/// <summary>
/// Describes an event that maps an XR controller input to a hand pose. This allows to show different poses when
/// certain buttons are pressed. It also allows to describe which poses need to be used when grabbing or pointing
/// with the finger.
/// </summary>
[Serializable]
public class UxrAvatarControllerEvent
{
#region Inspector Properties/Serialized Fields
[SerializeField] private UxrInputButtons _buttons;
[SerializeField] private UxrAnimationType _animationType;
[SerializeField] private UxrHandPoseAsset _handPose;
[SerializeField] [Range(0.0f, 1.0f)] private float _poseBlendValue;
#endregion
#region Public Types & Data
/// <summary>
/// Gets the hand pose name that should be used on the event.
/// </summary>
public string PoseName => string.IsNullOrEmpty(_poseNameOverride) ? _handPose != null ? _handPose.name : null : _poseNameOverride;
/// <summary>
/// Gets or sets the button(s) that trigger the animation event.
/// </summary>
public UxrInputButtons Buttons
{
get => _buttons;
set => _buttons = value;
}
/// <summary>
/// Gets the type of animation the event represents. This allows to keep track of certain key animations such as
/// grabbing or pointing with the finger, that are used in the framework.
/// </summary>
public UxrAnimationType TypeOfAnimation
{
get => _animationType;
set => _animationType = value;
}
/// <summary>
/// Gets or sets the pose name that will be used instead of the pose stored. If null, the pose will be used instead.
/// </summary>
public string PoseNameOverride
{
get => _poseNameOverride;
set => _poseNameOverride = value;
}
/// <summary>
/// Gets or sets the pose blend value if the pose is <see cref="UxrHandPoseType.Blend" />.
/// </summary>
public float PoseBlendValue
{
get => _poseBlendValue;
set => _poseBlendValue = value;
}
#endregion
#region Public Overrides object
/// <inheritdoc />
public override string ToString()
{
return $"Event type: {_animationType}, button(s): {_buttons}, pose: {PoseName}, blend: {_poseBlendValue}";
}
#endregion
#region Private Types & Data
private string _poseNameOverride;
#endregion
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: ae488b3f906744fa8c3716371798b17e
timeCreated: 1642868667

View File

@@ -0,0 +1,23 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="UxrEventVarAction.cs" company="VRMADA">
// Copyright (c) VRMADA, All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
using UnityEngine;
namespace UltimateXR.Avatar.Controllers
{
/// <summary>
/// Enumerates possible actions over an <see cref="Animator" /> component. Used by
/// <see cref="UxrStandardAvatarController" />.
/// </summary>
public enum UxrEventVarAction
{
DoNothing,
ToggleBool,
SetBool,
SetInt,
SetFloat,
Trigger
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 3030f7d0b28644dca25a59c235aa629d
timeCreated: 1642868731

View File

@@ -0,0 +1,87 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="UxrFingerPointingVolume.cs" company="VRMADA">
// Copyright (c) VRMADA, All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
using UltimateXR.Core;
using UltimateXR.Core.Components;
using UltimateXR.Extensions.Unity.Math;
using UnityEngine;
namespace UltimateXR.Avatar.Controllers
{
/// <summary>
/// Component that describes a box volume where any <see cref="UxrAvatar" /> hand that gets inside automatically adopts
/// a finger pointing pose. This is useful to place in front of UI screens or where precise finger pressing interaction
/// is required.
/// </summary>
/// <remarks>
/// The finger pointing pose should only be adopted if it doesn't interfere with any other interaction, such
/// as the grab pose while grabbing an object inside the volume.
/// </remarks>
[RequireComponent(typeof(BoxCollider))]
public class UxrFingerPointingVolume : UxrComponent<UxrFingerPointingVolume>
{
#region Inspector Properties/Serialized Fields
[SerializeField] private bool _leftHand = true;
[SerializeField] private bool _rightHand = true;
#endregion
#region Public Types & Data
/// <summary>
/// Gets the <see cref="BoxCollider" /> component describing the enclosed space where to adopt the finger pointing
/// pose.
/// </summary>
public BoxCollider Box => GetCachedComponent<BoxCollider>();
/// <summary>
/// Gets or sets whether the left hand should adopt the pose when inside.
/// </summary>
public bool UseLeftHand
{
get => _leftHand;
set => _leftHand = value;
}
/// <summary>
/// Gets or sets whether the right hand should adopt the pose when inside.
/// </summary>
public bool UseRightHand
{
get => _rightHand;
set => _rightHand = value;
}
#endregion
#region Public Methods
/// <summary>
/// Checks if a point is inside the <see cref="BoxCollider" /> attached to the <see cref="GameObject" /> this component
/// is attached to.
/// </summary>
/// <param name="point">Point in world coordinates</param>
/// <param name="margin">Margin to add to the box sides</param>
/// <returns>True if it is inside, false if not</returns>
public bool IsPointInside(Vector3 point, float margin = 0.0f)
{
return point.IsInsideBox(Box, Vector3.one * margin);
}
/// <summary>
/// Checks if the volume is compatible with the given hand. This allows some volumes to work for the left or
/// right hand only.
/// </summary>
/// <param name="handSide">Hand to check</param>
/// <returns>Boolean telling whether the given hand is compatible or not</returns>
public bool IsCompatible(UxrHandSide handSide)
{
return (handSide == UxrHandSide.Left && UseLeftHand) || (handSide == UxrHandSide.Right && UseRightHand);
}
#endregion
}
}

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: db12429e9acfd824a9ecbc4760a629bf
timeCreated: 1504532444
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,162 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="UxrHandPoseVolume.cs" company="VRMADA">
// Copyright (c) VRMADA, All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
using UltimateXR.Core;
using UltimateXR.Core.Components;
using UltimateXR.Extensions.Unity.Math;
using UnityEngine;
namespace UltimateXR.Avatar.Controllers
{
/// <summary>
/// Component that describes a box volume where any <see cref="UxrAvatar" /> hand that gets inside automatically adopts
/// a given hand pose.
/// </summary>
/// <remarks>
/// The finger pointing pose should only be adopted if it doesn't interfere with any other interaction, such
/// as the grab pose while grabbing an object inside the volume.
/// </remarks>
[RequireComponent(typeof(BoxCollider))]
public class UxrHandPoseVolume : UxrComponent<UxrHandPoseVolume>
{
#region Inspector Properties/Serialized Fields
[SerializeField] private string _poseName;
[SerializeField] private bool _leftHand = true;
[SerializeField] private bool _rightHand = true;
#endregion
#region Public Types & Data
/// <summary>
/// Gets the <see cref="BoxCollider" /> component describing the enclosed space where to adopt the pose.
/// </summary>
public BoxCollider Box => GetCachedComponent<BoxCollider>();
/// <summary>
/// Gets or sets whether the left hand should adopt the pose when inside.
/// </summary>
public bool UseLeftHand
{
get => _leftHand;
set => _leftHand = value;
}
/// <summary>
/// Gets or sets whether the right hand should adopt the pose when inside.
/// </summary>
public bool UseRightHand
{
get => _rightHand;
set => _rightHand = value;
}
#endregion
#region Unity
/// <summary>
/// Subscribes to the avatars updated event.
/// </summary>
protected override void OnEnable()
{
base.OnEnable();
UxrManager.AvatarsUpdated += UxrManager_AvatarsUpdated;
}
/// <summary>
/// Unsubscribes from the avatars updated event.
/// </summary>
protected override void OnDisable()
{
base.OnDisable();
UxrManager.AvatarsUpdated -= UxrManager_AvatarsUpdated;
}
#endregion
#region Event Handling Methods
/// <summary>
/// Called every frame after the avatars have been updated. Performs the hand check.
/// </summary>
private void UxrManager_AvatarsUpdated()
{
if (UxrAvatar.LocalAvatar == null)
{
return;
}
if (UxrAvatar.LocalAvatar.AvatarController is UxrStandardAvatarController avatarController)
{
}
else
{
return;
}
if (IsCompatible(UxrHandSide.Left) && IsPointInside(UxrAvatar.LocalAvatar.GetHand(UxrHandSide.Left).Wrist.position))
{
avatarController.LeftHandDefaultPoseNameOverride = _poseName;
_leftWasInside = true;
}
else if (_leftWasInside)
{
avatarController.LeftHandDefaultPoseNameOverride = null;
_leftWasInside = false;
}
if (IsCompatible(UxrHandSide.Right) && IsPointInside(UxrAvatar.LocalAvatar.GetHand(UxrHandSide.Right).Wrist.position))
{
avatarController.RightHandDefaultPoseNameOverride = _poseName;
_rightWasInside = true;
}
else if (_rightWasInside)
{
avatarController.RightHandDefaultPoseNameOverride = null;
_rightWasInside = false;
}
}
#endregion
#region Private Methods
/// <summary>
/// Checks if a point is inside the <see cref="BoxCollider" /> attached to the <see cref="GameObject" /> this component
/// is attached to.
/// </summary>
/// <param name="point">Point in world coordinates</param>
/// <param name="margin">Margin to add to the box sides</param>
/// <returns>True if it is inside, false if not</returns>
private bool IsPointInside(Vector3 point, float margin = 0.0f)
{
return point.IsInsideBox(Box, Vector3.one * margin);
}
/// <summary>
/// Checks if the volume is compatible with the given hand. This allows some volumes to work for the left or
/// right hand only.
/// </summary>
/// <param name="handSide">Hand to check</param>
/// <returns>Boolean telling whether the given hand is compatible or not</returns>
private bool IsCompatible(UxrHandSide handSide)
{
return (handSide == UxrHandSide.Left && UseLeftHand) || (handSide == UxrHandSide.Right && UseRightHand);
}
#endregion
#region Private Types & Data
private bool _leftWasInside;
private bool _rightWasInside;
#endregion
}
}

View File

@@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 75af3a4860c324a4f8873ef035f52bec
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@@ -0,0 +1,48 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="UxrStandardAvatarController.ControllerEventTypes.cs" company="VRMADA">
// Copyright (c) VRMADA, All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
using System;
namespace UltimateXR.Avatar.Controllers
{
public partial class UxrStandardAvatarController
{
#region Private Types & Data
/// <summary>
/// Flags that control which <see cref="UxrAnimationType" /> to process when processing events.
/// </summary>
[Flags]
private enum ControllerEventTypes
{
/// <summary>
/// No types.
/// </summary>
None = 0,
/// <summary>
/// All other animation types that are not <see cref="Grab" /> or <see cref="Point" />.
/// </summary>
Other = 1,
/// <summary>
/// Events that are for the grab animation.
/// </summary>
Grab = 1 << 1,
/// <summary>
/// Events that are for the finger pointing animation.
/// </summary>
Point = 1 << 2,
/// <summary>
/// All event.
/// </summary>
All = ~None
}
#endregion
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 94f8b332033d4435b104cf1d25c38dac
timeCreated: 1645458547

View File

@@ -0,0 +1,44 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="UxrStandardAvatarController.EventProcessing.cs" company="VRMADA">
// Copyright (c) VRMADA, All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
using System;
using UnityEngine;
namespace UltimateXR.Avatar.Controllers
{
public partial class UxrStandardAvatarController
{
#region Private Types & Data
/// <summary>
/// Flags that control which actions to perform when processing events.
/// </summary>
[Flags]
private enum EventProcessing
{
/// <summary>
/// Do nothing.
/// </summary>
None = 0,
/// <summary>
/// Update the internal state.
/// </summary>
InternalVars = 1,
/// <summary>
/// Execute the actions that change <see cref="Animator" /> variables.
/// </summary>
ExecuteActions = 2,
/// <summary>
/// Everything.
/// </summary>
All = ~None
}
#endregion
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 42a426d70a134452895a00468c1c35ae
timeCreated: 1645458565

View File

@@ -0,0 +1,78 @@
// --------------------------------------------------------------------------------------------------------------------
// <copyright file="UxrStandardAvatarController.HandInfo.cs" company="VRMADA">
// Copyright (c) VRMADA, All rights reserved.
// </copyright>
// --------------------------------------------------------------------------------------------------------------------
using UltimateXR.Devices;
namespace UltimateXR.Avatar.Controllers
{
public sealed partial class UxrStandardAvatarController
{
#region Private Types & Data
/// <summary>
/// Stores relevant information of a hand required by the <see cref="UxrStandardAvatarController" /> at runtime.
/// </summary>
private class HandInfo
{
#region Public Types & Data
/// <summary>
/// Gets or sets the index of the grab animation event. That is, the event whose animation is
/// <see cref="UxrAnimationType.LeftHandGrab" />/ <see cref="UxrAnimationType.RightHandGrab" />.
/// </summary>
public int GrabEventIndex { get; set; }
/// <summary>
/// Gets or sets the hand pose name of <see cref="GrabEventIndex" /> at the beginning.
/// </summary>
public string InitialHandGrabPoseName { get; set; }
/// <summary>
/// Gets or sets the <see cref="UxrAvatarControllerEvent.Buttons" /> required to activate the
/// <see cref="GrabEventIndex" /> at the beginning.
/// </summary>
public UxrInputButtons InitialHandGrabButtons { get; set; }
/// <summary>
/// Gets or sets whether the hand is currently grabbing.
/// </summary>
public bool IsGrabbing { get; set; }
/// <summary>
/// Gets or sets whether the hand is currently pointing.
/// </summary>
public bool IsPointing { get; set; }
/// <summary>
/// Gets or sets whether the hand has currently a finger tip inside a <see cref="IsInsideFingerPointingVolume" />.
/// </summary>
public bool IsInsideFingerPointingVolume { get; set; }
/// <summary>
/// Gets or sets whether the hand was grabbing last frame.
/// </summary>
public bool WasGrabbingLastFrame { get; set; }
/// <summary>
/// Gets or sets whether the hand was pointing last frame.
/// </summary>
public bool WasPointingLastFrame { get; set; }
/// <summary>
/// Gets or sets whether the hand should be let grab again. Used to control grab/release.
/// </summary>
public bool LetGrabAgain { get; set; }
/// <summary>
/// Gets or sets the value between range [0.0, 1.0] that controls the grab pose blending.
/// </summary>
public float GrabBlendValue { get; set; }
#endregion
}
#endregion
}
}

View File

@@ -0,0 +1,3 @@
fileFormatVersion: 2
guid: 90694b6e290d409199c86be7fa7e7f29
timeCreated: 1645461833

View File

@@ -0,0 +1,12 @@
fileFormatVersion: 2
guid: eed24b4dea1e5534ba091b2188144a9f
timeCreated: 1500469656
licenseType: Pro
MonoImporter:
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant: