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:
    159
    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:
    159
    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:
    100
  5. grobonom

    grobonom

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

    hope it will help ^^

    Happy unitying !
     
  6. grobonom

    grobonom

    Joined:
    Jun 23, 2018
    Posts:
    159
    @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:
    159

    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
  8. grobonom

    grobonom

    Joined:
    Jun 23, 2018
    Posts:
    159
  9. andrews_unity

    andrews_unity

    Unity Technologies

    Joined:
    Dec 11, 2015
    Posts:
    100
    This has been resolved and should be in 2019.3 latest release and 2018.4 next release. Thanks for the bug report.
     
  10. grobonom

    grobonom

    Joined:
    Jun 23, 2018
    Posts:
    159
    nice !!!! :D i'll try this ASAP !

    Thanks a lot Andrews :)

    Happy unitying !
     
  11. grobonom

    grobonom

    Joined:
    Jun 23, 2018
    Posts:
    159
    @andrews_unity
    Unfortunately 2019.3.0f6 still proudly got the bug :p

    Did you even try to do something for solving this ? :rolleyes:

    On my side, i'm setting up a dev env on a linux for making an SO lib serving my unity app for cursor things from X server. I did this 15 years ago..... amazing U3D cannot :p hehehe

    I keep you informed ^^

    Happy unitying !
     
  12. andrews_unity

    andrews_unity

    Unity Technologies

    Joined:
    Dec 11, 2015
    Posts:
    100

    I verifed the issue on versions of linux that we support, which is Ubuntu 16.04, 18.04 and Centos 7. We also only support running in bare metal hardware; which means no VMware or anything like that.

    So to answer your question yes I verified that this worked on 2019.3 and that it was back ported to 2018.4
     
    grobonom likes this.
  13. grobonom

    grobonom

    Joined:
    Jun 23, 2018
    Posts:
    159
    Hi @andrews_unity

    Yes you are absolutely right !

    All things work fine after i understoob the problem was coming from vmware !
    It appears i owe you my apologies as well just like in this post:
    https://forum.unity.com/threads/weird-mouse-input-with-locked-cursor.357572/page-2#post-5440491
    Where i give the workaround:

    vmmouse.present = "FALSE"

    to set in the vmware conf file for making everything work properly :)

    I give this here as i think many people use vmware for running linuxes on windows/mac platforms.

    Thanks a bunch for your patience and kindness :)

    Happy unitying !
     
unityunity