Skip to main content
Up and Coming
May 22, 2018

Can't get the accelerometer to work on Oculus Go, but works fine on Gear VR?


I have a game on the store called Jogger which uses the accelerometer to detect for when someone is jogging on the spot to move forward.
This has been on the store for over a year now and works great, however it's not working on the Oculus Go.

Is there a different way to access the gyro on the Oculus Go?
For the Gear VR I can use "Input.gyro.userAcceleration" but this just returns 0 0 0 on the Go?

Any help would be greatly appreciated at this point because I've had to remove Jogger from the Go store until I can find out why it's not working.
    This topic has been closed for replies.

    22 replies

    Participant
    June 1, 2018


    @stregillus I can get readings for acceleration in that same way as well. I just changed angularAcceleration to acceleration and it worked.


    Hmm, this is on the Go for sure?  I've tried 3 different OVRDisplays:

    Instantiated during Start:
    OVRDisplay _ovrDisplay;
    Start(){
    _ovrDisplay = new OVRDisplay();
    }

    Update(){
    Debug.Log(_ovrDisplay.acceleration);
    }
    Instantiated every frame
    Update(){
    OVRDisplay ovrDisplay = new OVRDisplay();
    Debug.Log(ovrDisplay.acceleration);
    }
    Retrieved using OVRManager.display
    Update(){
    Debug.Log(OVRManager.display.acceleration);
    }
    All of these return vectors that are all 0s.  

    @"sara.hanson.12382" the only thing I can think of is you're not using a Go (maybe you're using a GearVR or a full Oculus headset), or you have a different firmware or OS version from me that's leading to the different behavior.

    Could you maybe  let me know:
    • Your version of Unity
    • Your OS version on the Go
    • Whether it is a devkit Go or a commercial one
    Thanks!  
    -Sam


    Participant
    June 1, 2018
    I've made a pretty big breakthrough!  I was looking at the code that is actually returned by OVRDisplay.acceleration, and it looked like this:
    public Vector3 acceleration
    {
    get {
    if (!OVRManager.isHmdPresent) {
    return Vector3.zero;
    }

    return OVRPlugin.GetNodeAcceleration(OVRPlugin.Node.None, OVRPlugin.Step.Render).FromFlippedZVector3f();
    }
    }
    Note the "Node.None" there!  I changed it to Node.Head, so now it looks like this:
    public Vector3 acceleration
    {
    get {
    if (!OVRManager.isHmdPresent) {
    return Vector3.zero;
    }

    return OVRPlugin.GetNodeAcceleration(OVRPlugin.Node.Head, OVRPlugin.Step.Render).FromFlippedZVector3f();
    }
    }
    Now I'm getting the values I want!  It looks like these units are in Meters/Second squared.  In my case, my code was originally programmed to assume Gs, so I just divided that number by 9.8, and I'm getting the values that I seem to want.

    @Gnimmel, I'm fairly certain that you're using my VR-Step plugin (I am the dev of that), feel free to PM me on here, and I can help you adapt the code for the Go.  The values are still a bit higher than they were on GoogleVR, even after dividing by 9.8, so some other things need to be tweaked.  I'll also probably update the plugin now that I know what's going on.
    Up and Coming
    June 2, 2018
    @stregillus nice!

    Are you able to similarly get acceleration values for the GO controller?
    Participant
    June 2, 2018
    @carrotstien The Go controller has never really been an issue, you can access that information easily with OVRInput.GetLocalControllerAcceleration.  Look at the OVRGearVrControllerTest.cs that comes with the Unity plugin for everything to do wtih the controllers.
    New Participant
    June 2, 2018
    @carrotstien
    @stregillus
    I don't have the tech with me right now, so I can't give you specifics but its definitely the Go. And I when I posted my follow-up I also edited my original comment to include the code for acceleration. Hope you figured it out.
    Participant
    June 3, 2018
    Hi @"sara.hanson.12382" , I wonder if maybe you're using a different version of the Oculus Unity plugin?  Can you look at the code for the acceleration parameter in OVRDisplay.cs and let me know what it looks like?  

    Doesn't really matter now, but thank you for letting me know that it was working for you, which prompted me to dig in a lot further and fix it myself.  
    June 7, 2018
    Fyi, the patch proposed by @stregillus has found its way upstream in Oculus Utilities 1.26:

    > 
    Fixed bug causing head velocity and acceleration to always be 0.

    Release notes: https://developer.oculus.com/documentation/unity/latest/concepts/release-1.26/
    Download Oculus Utilties 1.26: https://developer.oculus.com/downloads/package/oculus-utilities-for-unity-5/1.26.0/
    GnimmelAuthor
    Up and Coming
    June 11, 2018
    I was out of the studio all last week so sorry for the late reply.

    @stregillus Yes, the game I'm having problems with is Jogger, which is on your asset store page as an example for VR Step.

    Thanks for looking into this, I have a few things to catch up on today and then I will be looking at this again and hopefully have a Go version of Jogger working soon.

    Participant
    June 12, 2018
    A few things to note:
    • Using OVRDisplay.acceleration (with the fix to replace Node.none to Node.head) works on the Go, but doesn't seem to work with a GearVR + Galaxy S7.  I have to use Input.gyro with the S7, which I guess means that I am not getting the "better" gyro sensor inputs from the GearVR.  This is OK, but just a bit annoying to have to detect.
    • I had originally thought that the units were Meters/sec squared, but they seem a bit higher, and I actually think that they might be in Feet/sec squared?  @imperativity can you confirm with the devs what the units are for the OVRDisplay.acceleration reading?  
    Thanks!
    GnimmelAuthor
    Up and Coming
    June 14, 2018
    Thanks again for all the help on this.

    I haven't had the chance to get Jogger fully working yet, but I have got a small test project getting acceleration values now :)