Proper way to "reset" for game rotation?

Proper way to "reset" for game rotation?

ericdoleckiericdolecki Member Posts: 15
I have an app where if someone has been using their Frames in other apps, etc. they might have a different direction for 0. When the user clicks a "Go" button in my application, I'd like the position of their frames to calibrate to where they were looking when they tapped that button. Essentially setting that to 0. 

Best Answers

  • edited 05/09/2019 - 14:06 Answer ✓
    ericdoleckiericdolecki Member Posts: 15
    Ahh. So you're saying at startup or whenever, take current readings, zero them out, and then apply those vars that were needed to zero out and apply to readings going forward. I'll try that. 

    It might be nice to be able to have a session.device?.resetSensors() call or something similar in the future. 


  • ericdoleckiericdolecki Member Posts: 15
    My situation: Frames have been on and running for a while. It's 0 is different than when they launch my app. My app has the picker come up, a session is created, yet where they were looking when the session starts is different than what I want it to be. I also notice some game rotation drift. At some point, I would like to offer calibration. Are you saying when the session is created, wherever the Frames were facing should be 0? I have seen this to not be the case.

    It would be nice to have a session.device?.calibrate() method - I could tell the user to look straight ahead and have them tap a button or something to re-calibrate. 
  • Nadine@Bose[email protected] Member Posts: 111

    Hi @ericcdolecki,

    I see what you’re saying.  In short, you can program your Bose AR device to re-orient itself.  There is no API to recalibrate or re-orient device.  It’s up to you manage the orientation. You can manage the orientation via pitch, roll, and yaw.  For GameRotation, there is no calibration needed- only for absolute rotation. You can check out those details here:

    A really helpful example is the ScenceExample.  I’m not sure what your use case is or how you are managing the app, but when you double tap in the SceneViewController or press the “Reset initial orientation” button in the SettingsViewController, you call 

    ```self?.resetOrientation()```.  This function is in the SceneViewController.  The baseReadings gets set to ```nil``` when that happens. 

    In the update() function, baseReadings is set to nil.  At the moment double tap or the reset button is pressed, the current orientation of the device is taken via pitch, roll, and yaw for the baseReadings.  Let’s say the baseReadings are now:  ((pitch: -0.25137047167766546, roll: -0.10287041418552326, yaw: -1.9480170599941329)).  At the time of double tap or reset button is pressed baseReadings == quaternion values. I.E. baseReadings.pitch == quaternion.pitch. When you subtract those values, you get 0. I.E. you get (0,0,0) for pitch, roll, and yaw. Any movement in relation to (0,0,0) gets mapped to the object in the scene by subtracting the baseReadings from the current quaternion values. 

    I hope this helps answer your question. Please let me know how I can clarify.



  • ericdoleckiericdolecki Member Posts: 15
    I got that to work. Thanks :smile:
  • Nadine@Bose[email protected] Member Posts: 111
Sign In or Register to comment.