Skip to content

Commit fa8b577

Browse files
addressed more CRs
1 parent f0e414c commit fa8b577

File tree

1 file changed

+10
-4
lines changed

1 file changed

+10
-4
lines changed

Assets/MixedRealityToolkit/InputSystem/Gaze/GazeProvider.cs

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -65,13 +65,14 @@ public class GazeProvider : MonoBehaviour, IMixedRealityGazeProvider
6565
private Transform gazeTransform = null;
6666

6767
[SerializeField]
68-
[Range(0.1f, 5f)]
68+
[Range(0.01f, 1f)]
6969
[Tooltip("Minimum head velocity threshold")]
70-
private float minHeadVelocityThresh = 0.5f;
70+
private float minHeadVelocityThreshold = 0.5f;
7171

7272
[SerializeField]
73+
[Range(0.1f, 5f)]
7374
[Tooltip("Maximum head velocity threshold")]
74-
private float maxHeadVelocityThresh = 2f;
75+
private float maxHeadVelocityThreshold = 2f;
7576

7677
[SerializeField]
7778
[Tooltip("True to draw a debug view of the ray.")]
@@ -218,6 +219,11 @@ public override bool TryGetPointerRotation(out Quaternion rotation)
218219

219220
#region Monobehaiour Implementation
220221

222+
private void OnValidate()
223+
{
224+
Debug.Assert(minHeadVelocityThreshold < maxHeadVelocityThreshold, "Maximum head velocity threshold should be less than the minimum velocity threshold.");
225+
}
226+
221227
protected virtual void OnEnable()
222228
{
223229
if (!delayInitialization)
@@ -285,7 +291,7 @@ private void LateUpdate()
285291
}
286292

287293
// Update Head Movement Direction
288-
float multiplier = Mathf.Clamp01(Mathf.InverseLerp(minHeadVelocityThresh, maxHeadVelocityThresh, HeadVelocity.magnitude));
294+
float multiplier = Mathf.Clamp01(Mathf.InverseLerp(minHeadVelocityThreshold, maxHeadVelocityThreshold, HeadVelocity.magnitude));
289295

290296
Vector3 newHeadMoveDirection = Vector3.Lerp(headPosition, HeadVelocity, multiplier).normalized;
291297
lastHeadPosition = headPosition;

0 commit comments

Comments
 (0)