Search Unity

  1. Welcome to the Unity Forums! Please take the time to read our Code of Conduct to familiarize yourself with the forum rules and how to post constructively.
  2. Dismiss Notice

Bug [solved] Input.getAxis returning 0 at edge of screen

Discussion in 'Linux' started by cm33, Feb 22, 2016.

  1. cm33

    cm33

    Joined:
    Jan 24, 2015
    Posts:
    8
    When using standard asset's FPSController, the player is only able to rotate left and right with the mouse up to a point, after which further horizontal movement of the mouse doesn't do anything.

    Debug.Console reveals that Input.getAxis is returning 0 after a certain point. This only happens on Linux builds and in the Linux editor. Exact same code works fine on OSX and Windows.

    This is happening on game mode in the latest Linux editor build 5.3.2, and also 5.3.x/5.2.x Windows-editor-built Linux builds.
     
  2. LukaKotar

    LukaKotar

    Joined:
    Sep 25, 2011
    Posts:
    394
    The mouse input in the Linux editor is very buggy, especially if the mouse cursor is locked. I made a thread about it as well.

    I didn't have any issues of the sort in builds. Does it only happen if you build from Windows?
     
  3. cm33

    cm33

    Joined:
    Jan 24, 2015
    Posts:
    8
    Unfortunately not. It happens in Linux Editor in game mode, as well as builds created from the Linux editor. It is possible to create some hacky workarounds, but I'd really rather not.
     
  4. cm33

    cm33

    Joined:
    Jan 24, 2015
    Posts:
    8
    btw, what Linux editor version are you using? Which player controller are you using? I wonder if I use something other than getAxis if this can be worked around?
     
  5. LukaKotar

    LukaKotar

    Joined:
    Sep 25, 2011
    Posts:
    394
    I use version 5.3.2. I have a custom controller setup, however that shouldn't matter. I use GetAxis for my mouse look. My cursor is locked at the center and hidden, maybe that has something to do with the fact that it works in build.
     
    cm33 likes this.
  6. cm33

    cm33

    Joined:
    Jan 24, 2015
    Posts:
    8
    Thanks! I'll give that a shot.

    Do you unhide/unlock the cursor upon some keypress so the user can use the mouse, or do you not need the mouse cursor functionality in your app/game?
     
  7. cm33

    cm33

    Joined:
    Jan 24, 2015
    Posts:
    8
    OK, I tried locking and hiding the cursor, and the problem gets 1/2 fixed. :)

    Before, rotation was locking up turning both left and right. Now, turning left works great - I can rotate indefinitely turning left. Turning right still locks up after 45 degrees or so.

    Checking Input.GetAxis confirms that it still returns zero when this locking up behavior happens.

    It looks like I'm seeing the identical problem reported http://forum.unity3d.com/threads/weird-mouse-input-with-locked-cursor.357572/#post-2313575

    This issue was in-editor. Let me try building and testing it out.

    Update: with cursor locked and hidden, built game works fine! So it's just the in-editor game mode that's bugged now. Thanks so much!
     
    Last edited: Feb 24, 2016
    JorgeAires likes this.