Search Unity

Good Ole Input.GetAxis and Cursor.LockMode

Discussion in 'Linux' started by KnuckleCracker, Jan 10, 2019.

  1. KnuckleCracker

    KnuckleCracker

    Joined:
    Dec 27, 2011
    Posts:
    63
    This has been a problem in the past (from what google tells me). But seems it was fixed sometime around unity 2017. I test linux about once a year, so here I find myself.... Anyway, before I log a bug into the abyss, I'm curious if anyone else has encountered this issue.

    2018.2.17 and 2018.2.20 tested.
    Set Cursor.lockState = CursorLockMode.Locked. Now call Input.GetAxis("Mouse X").
    You don't get back 0.1, or 0.5, or 1, you get back 3000, or more.

    Set Cursor.lockState = CursorLockMode.None (or Confined). Call Input.GetAxis("Mouse X").
    You get back 0.1, 0.2, etc. as expected.

    Only happens on Linux (I tested using Ubuntu 18). Windows and Mac OS are fine. Only happens when the cursor is locked (as one is apt to do for implementing a mouse driven camera look).
     
    grobonom likes this.
  2. grobonom

    grobonom

    Joined:
    Jun 23, 2018
    Posts:
    111
    Yes.

    I compiled my app to linux for the 1st time yesterday and yes, with locked cursor, getaxis is fu*ked-up :(

    I bet someone alrdy found a solution, but i got to search on forum to find it :/

    If anyone knows about the answer, please post here :) this would speed up the search ;)

    thx in advance.

    Happy unitying !
     
  3. grobonom

    grobonom

    Joined:
    Jun 23, 2018
    Posts:
    111
    hmmmm i'll have to try something pretty dirty ^^

    Cursor.lockState = CursorLockMode.None;
    x=Input.GetAxis("Mouse X");
    Cursor.lockState = CursorLockMode.Locked;


    Almost sure it won't work but it's worth the try :)
     
  4. andrews_unity

    andrews_unity

    Unity Technologies

    Joined:
    Dec 11, 2015
    Posts:
    18
  5. grobonom

    grobonom

    Joined:
    Jun 23, 2018
    Posts:
    111
    i do this today :)

    hope it will help ^^

    Happy unitying !
     
  6. grobonom

    grobonom

    Joined:
    Jun 23, 2018
    Posts:
    111
    @andrews_unity

    now bug is submitted.....

    i struggled on this today....

    input... inputraw....

    It appears to be a compatibility prob between unity mouse capture and the way X11 server handles the mouse :/

    I thought X11 handled mouse from top-left screen... hmmm yes.... but deltas are sometimes crazy ( like -18K on X )

    IMHO U3D devs should dig in nux mouse handling and find the reason of those crazy values. I guess it's a fight between X-server and U3D mouse capture.
    X11 gives a mouse pos but U3D should get it from deeper ( hard polling or something.... )
    years ago i fought for this and found a way for my apps compiled with GCC.
    There a libs allowing mouse access under ( or at lower lvl ) X server. And i found no other way....

    This worked for me at the time but it was ubuntu dapper drake..... long time ago :(

    nux is just perfect for many things.... just this mouse S*** ruins all....

    I believe now U3D is big enough for talking with buntu ( or better: Debian ) devs to make them consider the way they handle mouse ( even if Deb devs don't master X11 developments.... ).
    Maybe a dev ( i wish i had time and the knowledge i had in the past for deving a module grabbing X11 mouse and offering it to apps thru a small API ) can dev some kinda interface X11<--->U3D ?
    This would be great !

    Still dreamin' ;)

    I hope for a workaround !

    Happy Unitying !
     
  7. grobonom

    grobonom

    Joined:
    Jun 23, 2018
    Posts:
    111

    As i guessed it.... this just don't work :'(

    kinda awaited but it was worth the try.
    Hopelessly in U3D we don't have lower mouse capture API....
    And the one we got is S***ty...
    ( cryyyyyyyyy :'( )

    happy unitying !
     
    Last edited: Aug 15, 2019