Search Unity

Controller Analog Stick Drift with Windows Mixed Reality Controllers & SteamVR - a code fix!

Discussion in 'Windows Mixed Reality' started by ROBYER1, May 3, 2019.

  1. ROBYER1

    ROBYER1

    Joined:
    Oct 9, 2015
    Posts:
    464
    Just sharing this information for any other developers who notice the analog sticks on Windows Mixed Reality controllers not sitting at 0.

    We needed to clamp (deadzone) our analog stick values to prevent the drift from happening, hopefully a future firmware fix will come for this though. This isn't just exclusive to steamvr either,

    Find an example below of where we take the absolute value and clamp it if it is +/- 0.13

    Credit goes to Whitway Studios who gave us this tip on the Steam Community Forums
    https://steamcommunity.com/app/719950/discussions/0/1700542968202115701/?ctp=3

    Code (CSharp):
    1.                 float rightx = touchPadVector.x;
    2.                 if(Mathf.Abs(rightx) <= 0.13)
    3.                 {
    4.                     rightx = 0;
    5.                 }