Skip to content

Commit

Permalink
fix(Pointer): ensure ToggleBeam() turns off bezier pointer
Browse files Browse the repository at this point in the history
The `ToggleBeam` method was not turning off the bezier pointer as it
was only setting the bezier state to inactive but not actually changing
the visibility of the bezier pointer.

This fix ensures that the bezier pointer objects are turned off when
the beam is toggled off.
  • Loading branch information
thestonefox committed Jan 9, 2017
1 parent 9bb8a3e commit 44d55aa
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 3 deletions.
16 changes: 14 additions & 2 deletions Assets/VRTK/Scripts/Pointers/VRTK_BezierPointer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -134,13 +134,25 @@ protected override void TogglePointer(bool state)
{
state = (pointerVisibility == pointerVisibilityStates.Always_On ? true : state);
beamActive = state;
if (!beamActive)
{
ToggleBezierBeam(beamActive);
}
}

protected override void DisablePointerBeam(object sender, ControllerInteractionEventArgs e)
{
base.DisablePointerBeam(sender, e);
TogglePointerCursor(false);
curvedBeam.TogglePoints(false);
ToggleBezierBeam(false);
}

private void ToggleBezierBeam(bool state)
{
if (gameObject.activeInHierarchy)
{
TogglePointerCursor(state);
curvedBeam.TogglePoints(state);
}
}

private GameObject CreateCursor()
Expand Down
5 changes: 4 additions & 1 deletion Assets/VRTK/Scripts/Pointers/VRTK_PlayAreaCursor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -116,7 +116,10 @@ public virtual void SetPlayAreaCursorTransform(Vector3 location)
public virtual void ToggleState(bool state)
{
state = (!enabled ? false : state);
playAreaCursor.SetActive(state);
if (playAreaCursor)
{
playAreaCursor.SetActive(state);
}
}

protected virtual void Awake()
Expand Down

0 comments on commit 44d55aa

Please sign in to comment.