Search Unity

Bug XRUIInputModule.pixelDragThresholdMultiplier wrong math (with fix)

Discussion in 'XR Interaction Toolkit and Input' started by freso, Apr 23, 2021.

  1. freso

    freso

    Joined:
    Mar 19, 2013
    Posts:
    73
    UIInputModule.cs:353
    Code (CSharp):
    1. if ((eventData.pressPosition - eventData.position).sqrMagnitude >= ((eventSystem.pixelDragThreshold * eventSystem.pixelDragThreshold) * pixelDragThresholdMultiplier))
    You're not including the modifier in the x*x:ing.
    This fixes it:
    Code (CSharp):
    1. float threshold = eventSystem.pixelDragThreshold * pixelDragThresholdMultiplier;
    2. if ((eventData.pressPosition - eventData.position).sqrMagnitude >= (threshold * threshold)
    Easily confirmed by setting modifier threshold to 100. Obviously threshold is not 100* before fix. After fix it works.
     
    Last edited: Aug 14, 2021
  2. chris-massie

    chris-massie

    Unity Technologies

    Joined:
    Jun 23, 2020
    Posts:
    232
    Thank you for the bug report, we've captured it and will fix it in a later version.