Skip to content

Commit

Permalink
fix(Locomotion): always force small blink on distance blink delay
Browse files Browse the repository at this point in the history
If distance blink delay is enabled on the teleporter but the teleport
position was not far enough then a blink would not occur. This fix
ensures that a blink always occurs if there is a distance blink
delay set.
  • Loading branch information
thestonefox committed Mar 14, 2017
1 parent 619736a commit 98e52ac
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions Assets/VRTK/Scripts/Locomotion/VRTK_BasicTeleport.cs
Expand Up @@ -222,9 +222,10 @@ protected virtual void CalculateBlinkDelay(float blinkSpeed, Vector3 newPosition
blinkPause = 0f;
if (distanceBlinkDelay > 0f)
{
float minBlink = 0.5f;
float distance = Vector3.Distance(playArea.position, newPosition);
blinkPause = Mathf.Clamp((distance * blinkTransitionSpeed) / (maxBlinkDistance - distanceBlinkDelay), 0, maxBlinkTransitionSpeed);
blinkPause = (blinkSpeed <= 0.25 ? 0f : blinkPause);
blinkPause = Mathf.Clamp((distance * blinkTransitionSpeed) / (maxBlinkDistance - distanceBlinkDelay), minBlink, maxBlinkTransitionSpeed);
blinkPause = (blinkSpeed <= 0.25 ? minBlink : blinkPause);
}
}

Expand Down

0 comments on commit 98e52ac

Please sign in to comment.