VR4Medical/ICI/Library/PackageCache/com.unity.xr.interaction.toolkit@42ef3600567b/Runtime/Utilities/Tweenables/Primitives/QuaternionTweenableVariable.cs
2025-07-29 13:45:50 +03:00

30 lines
1.2 KiB
C#

using System;
namespace UnityEngine.XR.Interaction.Toolkit.Utilities.Tweenables.Primitives
{
/// <summary>
/// Bindable variable that can tween over time towards a target Quaternion value.
/// Uses an synchronous implementation so the tween does not use the job system.
/// </summary>
[Obsolete("The Affordance System namespace and all associated classes have been deprecated. The existing affordance system will be moved, replaced and updated with a new interaction feedback system in a future version of XRI.")]
public class QuaternionTweenableVariable : TweenableVariableSynchronousBase<Quaternion>
{
/// <summary>
/// Angle threshold in degrees, under which two quaternions are considered equal.
/// </summary>
public float angleEqualityThreshold { get; set; } = 0.01f;
/// <inheritdoc />
protected override Quaternion Lerp(Quaternion from, Quaternion to, float t)
{
return Quaternion.Slerp(from, to, t);
}
/// <inheritdoc />
protected override bool IsNearlyEqual(Quaternion startValue, Quaternion targetValue)
{
return Quaternion.Angle(startValue, targetValue) < angleEqualityThreshold;
}
}
}