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.