Samsung / GearVRf

The GearVR framework(GearVRf) is an Open Source VR rendering library for application development on VR-supported Android devices.
http://www.gearvrf.org
Apache License 2.0
407 stars 217 forks source link

OculusGO Controller position after camera.resetYaw() #2031

Open mpolsz opened 5 years ago

mpolsz commented 5 years ago

In our app we use mainScene.getMainCameraRig().resetYaw(); to recenter user view to known position. After resetYaw() camera is reseted properly (user looks in [0,0,-1] direction) but Oculus Go controller is pointing in semi random direction. You can reproduce this bug in my fork. Start application, turn head 90 degrees left or right and pull trigger on controller to call .resetYaw(). Scene will be in front of user but controller will point in wrong direction.

liaxim commented 5 years ago

@mpolsz Couldn't reproduce with GearVR and the latest master. Will try Oculus Go tomorrow.

liaxim commented 5 years ago

@mpolsz On Oculus Go it seems reasonable to me too. The controller points to where it pointed before in my tests, though one might expect the controller to be completely recentered (point to the center of the screen).

I am probably missing something so: how is the use of resetYaw different for you then long-pressing the Oculus home button which does the same thing semantically?

Attached a video of what I am seeing on Oculus Go. video.zip

mpolsz commented 5 years ago

@liaxim My bad, I wrote about turning head 90 degrees and what I meant was head AND controller. On video you point controller in [0, 0, -1] direction so it does not go out of sync. I will try reproducing this bug and upload video tomorrow.

liaxim commented 5 years ago

@mpolsz Ok, got it. Will look into it. Btw isn't long-pressing the home button on the controller doing what you want?

liaxim commented 5 years ago

@mpolsz See https://github.com/Samsung/GearVRf/pull/2032.

mpolsz commented 5 years ago

@liaxim I can confirm that using getGVRContext().recenterPose() instead of mainScene.getMainCameraRig().resetYaw() works as intended. One more thing we found out is that framework uses resetYaw() internally in GVRViewManager::updateSensoredScene and it can sometimes mess with rotation.

liaxim commented 5 years ago

@mpolsz Thanks for pointing updateSensoredScene out. Will look into that. Why wouldn't you rely on long pressing the home button on the controller to recenter?

I am unsure we can merge this change though. It is not likely easy to implement for Daydream. There is no similar API in Daydream that does what Oculus' vrapi_RecenterPose does. Daydream says this: On the Daydream platform, recentering is handled automatically and should never be triggered programatically by applications..

mpolsz commented 5 years ago

In our app (Evryplace) we reset pose automatically every time user changes scene (our internal scene, not GVRf one). We do that, so after arriving in next scene user faces predefined direction independent of headset rotation. What we do on scene change is basically:

  1. reset pose so user faces [0,0,-1]
  2. initialize all scene objects (with common root object)
  3. rotate common root with predefined rotation (only yaw) That way first thing user sees on scene change is whatever we define as arrival direction