Skip to content

Commit

Permalink
Remove activation range
Browse files Browse the repository at this point in the history
A bug in unity input system prevents WasPressedThisFrame from being useful right now. will look at forking and patching.
  • Loading branch information
mikeskydev committed Aug 16, 2022
1 parent c627400 commit 0e640ed
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 26 deletions.
8 changes: 2 additions & 6 deletions Assets/Scripts/Input/UnityXRControllerInfo.cs
Original file line number Diff line number Diff line change
Expand Up @@ -206,13 +206,9 @@ private bool MapVrInput(VrInput input)
case VrInput.Touchpad:
return FindAction("PadButton").IsPressed();
case VrInput.Trigger:
var triggerValue = GetTriggerValue();
Vector2 triggerRange = App.VrSdk.VrControls.TriggerActivationRange(Behavior.ControllerName);
return triggerValue > triggerRange.x;
return FindAction("TriggerAxis").IsPressed();
case VrInput.Grip:
var gripValue = GetGripValue();
Vector2 gripRange = App.VrSdk.VrControls.GripActivationRange;
return gripValue > gripRange.x;
return FindAction("GripAxis").IsPressed();
case VrInput.Button01:
case VrInput.Button04:
case VrInput.Button06:
Expand Down
20 changes: 0 additions & 20 deletions Assets/Scripts/Input/VrControllers.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,7 @@ public class VrControllers : MonoBehaviour
[SerializeField] private float m_HapticAmplitudeScale = 1.0f;

[Header("Input Zones")]
[SerializeField] private Vector2 m_TriggerActivationRange = new Vector2(0.15f, .8f);
[SerializeField] private Vector2 m_GripActivationRange = new Vector2(0.15f, .8f);
[SerializeField] private Vector2 m_TouchpadActivationRange = new Vector2(-.8f, .8f);
[SerializeField] private Vector2 m_LogitechPenActivationRange = new Vector2(0.0f, 1.0f);
[SerializeField] private float m_WandRotateJoystickPercent = 0.7f;

// VR headsets (e.g., Rift, Vive, Wmr) use different hardware for their controllers,
Expand Down Expand Up @@ -93,13 +90,6 @@ public float WandRotateJoystickPercent
get => m_WandRotateJoystickPercent;
}

/// The usable range of the raw grip value.
/// This is currently only used as the threshold for analog -> boolean conversion.
public Vector2 GripActivationRange
{
get => m_GripActivationRange;
}

public ControllerBehaviorWand Wand
{
get => m_Wand;
Expand All @@ -126,16 +116,6 @@ public bool PrimaryScrollDirectionIsX(InputManager.ControllerName name)
return true;
}

public Vector2 TriggerActivationRange(InputManager.ControllerName name)
{
var behavior = GetBehavior(name);
if (behavior.ControllerGeometry.Style == ControllerStyle.LogitechPen)
{
return m_LogitechPenActivationRange;
}
return m_TriggerActivationRange;
}

/// Enable or disable tracking
public void EnablePoseTracking(bool enabled)
{
Expand Down

0 comments on commit 0e640ed

Please sign in to comment.