Skip to content

Commit

Permalink
Merge pull request #2670 from keveleigh/FixPointerLineVisibility
Browse files Browse the repository at this point in the history
Fix pointer line visibility when switching the active controller
  • Loading branch information
David Kline authored Aug 30, 2018
2 parents 7be94ea + 9f1db24 commit d7dc259
Showing 1 changed file with 14 additions and 5 deletions.
19 changes: 14 additions & 5 deletions Assets/HoloToolkit/Input/Scripts/Utilities/ControllerFinder.cs
Original file line number Diff line number Diff line change
Expand Up @@ -149,10 +149,7 @@ protected virtual void RemoveControllerTransform(MotionControllerInfo oldControl
#if UNITY_WSA && UNITY_2017_2_OR_NEWER
if (oldController.Handedness == handedness)
{
OnControllerLost();

ControllerInfo = null;
ElementTransform = null;
ResetControllerTransform();
}
#endif
}
Expand All @@ -162,7 +159,7 @@ protected virtual void RefreshControllerTransform()
#if UNITY_WSA && UNITY_2017_2_OR_NEWER
if (ControllerInfo != null)
{
RemoveControllerTransform(ControllerInfo);
ResetControllerTransform();
}

TryAndAddControllerTransform();
Expand All @@ -182,5 +179,17 @@ protected virtual void OnControllerFound() { }
/// without the overhead of needing to check that handedness matches.
/// </summary>
protected virtual void OnControllerLost() { }

/// <summary>
/// Lets all listeners know that the controller was lost, then resets the cached info
/// and transform, potentially in preparation of a new controller.
/// </summary>
private void ResetControllerTransform()
{
OnControllerLost();

ControllerInfo = null;
ElementTransform = null;
}
}
}

0 comments on commit d7dc259

Please sign in to comment.