Skip to content

Commit 0858451

Browse files
addressed some CRs
1 parent dc24edf commit 0858451

File tree

1 file changed

+10
-9
lines changed

1 file changed

+10
-9
lines changed

Assets/MixedRealityToolkit/InputSystem/Gaze/GazeProvider.cs

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

6767
[SerializeField]
68-
[Tooltip("Minimum velocity threshold")]
69-
private float idleHeadVelocityThresh = 0.5f;
68+
[Range(0.1f, 5f)]
69+
[Tooltip("Minimum head velocity threshold")]
70+
private float minHeadVelocityThresh = 0.5f;
7071

7172
[SerializeField]
72-
[Tooltip("Maximum velocity threshold")]
73-
private float movementHeadVelocityThresh = 2f;
73+
[Tooltip("Maximum head velocity threshold")]
74+
private float maxHeadVelocityThresh = 2f;
7475

7576
[SerializeField]
7677
[Tooltip("True to draw a debug view of the ray.")]
@@ -274,8 +275,8 @@ private void LateUpdate()
274275

275276
if (Time.fixedDeltaTime > 0)
276277
{
277-
float velAdjustRate = 3f * Time.fixedDeltaTime;
278-
HeadVelocity = HeadVelocity * (1f - velAdjustRate) + headDelta * velAdjustRate / Time.fixedDeltaTime;
278+
float velocityAdjustmentRate = 3f * Time.fixedDeltaTime;
279+
HeadVelocity = HeadVelocity * (1f - velocityAdjustmentRate) + headDelta * velocityAdjustmentRate / Time.fixedDeltaTime;
279280

280281
if (HeadVelocity.sqrMagnitude < VelocityThreshold * VelocityThreshold)
281282
{
@@ -284,13 +285,13 @@ private void LateUpdate()
284285
}
285286

286287
// Update Head Movement Direction
287-
float multiplier = Mathf.Clamp01(Mathf.InverseLerp(idleHeadVelocityThresh, movementHeadVelocityThresh, HeadVelocity.magnitude));
288+
float multiplier = Mathf.Clamp01(Mathf.InverseLerp(minHeadVelocityThresh, maxHeadVelocityThresh, HeadVelocity.magnitude));
288289

289290
Vector3 newHeadMoveDirection = Vector3.Lerp(headPosition, HeadVelocity, multiplier).normalized;
290291
lastHeadPosition = headPosition;
291-
float dirAdjustRate = Mathf.Clamp01(5f * Time.fixedDeltaTime);
292+
float directionAdjustmentRate = Mathf.Clamp01(5f * Time.fixedDeltaTime);
292293

293-
HeadMovementDirection = Vector3.Slerp(HeadMovementDirection, newHeadMoveDirection, dirAdjustRate);
294+
HeadMovementDirection = Vector3.Slerp(HeadMovementDirection, newHeadMoveDirection, directionAdjustmentRate);
294295

295296
if (debugDrawRay)
296297
{

0 commit comments

Comments
 (0)