1

I'm making an app using scene kit where i'd like to create an experience similar to 360 panoramic imaging in google cardboard where core motion detects tilting of the phone to view the image in different angles.

The only difference is that i can only get it to work in landscape like the code below. Portrait is giving me trouble.


This is my landscape mode code and it works fine. Any ideas how i'd get it into portrait mode?

        self.CameraNode.eulerAngles = SCNVector3(
            -Float((self.motionManager.deviceMotion?.attitude.roll)!) - Float(M_PI_2),
            Float((self.motionManager.deviceMotion?.attitude.yaw)!),
            -Float((self.motionManager.deviceMotion?.attitude.pitch)!)
        )

also i'm vaguely familiar with quaternions and the gimbal lock problem which is supposed to make this problem harder. But if that's the case then why is my landscape implementation fine? I'd really like to simply do an update to how i'm calculating my x,y, and z because there is a scene kit component to my and it's add x,y,z based.

stanley
  • 1,113
  • 1
  • 12
  • 26
  • 1
    I'm not sure I can solve this, but I am also not sure I fully understand the issue. What happens differently in landscape vs portrait? – nycynik Aug 30 '16 at 03:09
  • first, i achieved the ability to view a 360 image based on the tilting of the phone "google cardboard vr style" in landscape mode. then, i found the need to replicate this in portrait mode. but i am struggling to reimplement it when the phone is in a different orientation – stanley Aug 30 '16 at 03:11
  • the camera angle updates from the device motion output, and reimplementing the orientation for portrait instead of landscape has been unexpectedly difficult for me. – stanley Aug 30 '16 at 03:13
  • the answer here does it really clean with quaternions http://stackoverflow.com/a/33695442/1079379 – stanley Aug 30 '16 at 03:39

0 Answers0