Wand thumbstick sometimes returns zero while it's active
-
When the thumbstick is being moved sometimes we get a value of (0,0) instead of the proper one.
The culprit is probably this warning that pops up right before the zero value is returned:
WARN: [TFI]
Invalid wand controls state received.
UnityEngine.Logger:Log(LogType, String, Object)
TiltFive.Logging.Log:log(LogType, String, String, Object[]) (at Assets/Tilt Five/Scripts/Logging/Log.cs:176)
TiltFive.Logging.Log:Warn(String, Object[]) (at Assets/Tilt Five/Scripts/Logging/Log.cs:163)
TiltFive.Input:TryGetWandControlsState(Nullable`1&, ControllerIndex) (at Assets/Tilt Five/Scripts/Wand/Input.cs:429)
TiltFive.Input:Update() (at Assets/Tilt Five/Scripts/Wand/Input.cs:380)
TiltFive.TiltFiveManager:Update() (at Assets/Tilt Five/Scripts/TiltFiveManager.cs:98)Probably a known issue but thought I'd bring it up.
-
@Javier Whoa interesting, this is a great hotfix! We'll take a closer look at the trigger intermittent zero values .
-
Quick update on this, it's not just the thumbstick that returns zero but also the trigger
This was causing all sorts of issues in our app so I hotfixed it in case anyone wants a quick remedy
-- Input.cs --
//HOTFIX: fix intermitent thumbpad/trigger issue static WandControlsState? m_lastWandControlState = null; internal static bool TryGetWandControlsState(out WandControlsState? wandControlsState, ControllerIndex controllerIndex = ControllerIndex.Primary) { int result = 1; try { UInt32 buttons = 0; float[] stick = new float[2]; float trigger = 0f; Int64 timestamp = 0; result = NativePlugin.GetControllerState(controllerIndex, ref buttons, stick, ref trigger, ref timestamp); if (result != 0) { wandControlsState = null; //HOTFIX: fix intermitent glitch m_lastWandControlState = null; } else { var receivedControlsState = new WandControlsState(timestamp, buttons, new Vector2(stick[0], stick[1]), trigger); // Ignore invalid wand controls states. if(WandControlsState.Validate(receivedControlsState)) { wandControlsState = receivedControlsState; m_lastWandControlState = receivedControlsState; } else { Log.Warn($"Invalid wand controls state received."); //HOTFIX: fix intermitent glitch wandControlsState = m_lastWandControlState; return true; } } } catch (Exception e) { wandControlsState = null; Log.Error(e.Message); } return (0 == result); }
-
Thanks Javier, this is a known issue that we're debugging. We'll keep you posted on a fix.