Skip to content

Commit

Permalink
See if this fixes issues with wand controls triggering on stylus input
Browse files Browse the repository at this point in the history
[CI BUILD]
  • Loading branch information
andybak committed Oct 3, 2024
1 parent 74c40d9 commit b3d6522
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions Assets/Scripts/Input/UnityXRControllerInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -131,6 +131,11 @@ public override void Update()
}
}

private bool IsStylusActive()
{
return stylusState.isActive && isBrush;
}

public override Vector2 GetPadValueDelta()
{
var action = FindAction("ThumbAxis");
Expand Down Expand Up @@ -179,7 +184,7 @@ public override float GetScrollYDelta()
public override float GetGripValue()
{
#if OCULUS_SUPPORTED
if (stylusState.isActive)
if (IsStylusActive())
{
return stylusState.cluster_front_value ? 1.0f : 0;
}
Expand All @@ -195,7 +200,7 @@ public override float GetTriggerRatio()
public override float GetTriggerValue()
{
#if OCULUS_SUPPORTED
if (stylusState.isActive)
if (IsStylusActive())
{
return Math.Max(stylusState.tip_value, stylusState.cluster_middle_value);
}
Expand Down Expand Up @@ -243,21 +248,21 @@ private bool MapVrInput(VrInput input)
return FindAction("PadButton").IsPressed();
case VrInput.Trigger:
#if OCULUS_SUPPORTED
if (stylusState.isActive)
if (IsStylusActive())
return stylusState.cluster_middle_value > 0.2 || stylusState.tip_value > 0.2;
#endif
return FindAction("TriggerAxis").IsPressed();
case VrInput.Grip:
#if OCULUS_SUPPORTED
if (stylusState.isActive)
if (IsStylusActive())
return stylusState.cluster_front_value;
#endif
return FindAction("GripAxis").IsPressed();
case VrInput.Button01:
case VrInput.Button04:
case VrInput.Button06:
#if OCULUS_SUPPORTED
if (stylusState.isActive)
if (IsStylusActive())
return stylusState.cluster_back_value;
#endif
return FindAction("PrimaryButton").IsPressed();
Expand Down

0 comments on commit b3d6522

Please sign in to comment.