Tag: cmmotionmanager

Compute rate of change of orientation(angular measurement) along y axis?

I want to compute rate of change of orientation of the iPhone along y axis. 1. Initially i need to define the reference as y axis, 2. Then measure the rate of change of orientation(angular measurement) from the defined reference. Does CMAttitude provides a reliable angular measurements to implement this? Or Can i use rotational […]

How do I adjust CMMotionManager data for orientation under iOS 8?

My application uses CMMotionManager to track device motion, but iOS always returns device motion data in the standard device orientation (home button at the bottom). To get the motion data into the same orientation as my UIView, I accumulate the view transforms from my view down to the window like this: CGAffineTransform transform = self.view.transform; […]

Obtain absolute rotation using CMDeviceMotion?

I’m building a simple game with Sprite Kit, the screen doesn’t rotate but I want to know the angle the user is holding the phone for a game mechanic. The values I want to get can be easily retrieved with the accelerometer (x, y) but I have found this to be unreliable so I’m trying […]

CMDeviceMotion yaw values unstable when iPhone is vertical

In a iOS prototype I use a combination of CMDeviceMotion.deviceMotion.yaw and CLHeading.trueHeading to make stable compass heading that is responsive and accurate. This works well when the iPhone is held flat, where I have a graphical arrow that point to a stable compass heading. The problem appear when the iPhone is held vertical in portait […]

Safe update interval for startDeviceMotionUpdatesToQueue:withHandler:?

EDIT: added a global and now it’s working. But I still have my doubts.. Please read on 🙂 I want to get the acceleration exercised on the Y-axis whenever I need to and use it in different parts of my code. In this example I’m using it inside a while-loop for testing purposes.. My code […]

Motion Manager is not working in Swift

I am try to use motion manager in Swift but the log inside my update block never prints. var motionManager: CMMotionManager = CMMotionManager() motionManager.accelerometerUpdateInterval = 0.01 println(motionManager.deviceMotionAvailable) // print true println(motionManager.deviceMotionActive) // print false motionManager.startDeviceMotionUpdatesToQueue(NSOperationQueue.currentQueue(), withHandler:{ deviceManager, error in println(“Test”) // no print }) println(motionManager.deviceMotionActive) // print false My Objective-C implementation works fine. Does anyone […]

cameranode rotate as iOS device moving

It’s 360 degree video player project. I add a cameranode(SCNNode) to a rootnode, the cameranode was put at the center(0,0,0) of the SCNSphere, It can play video by now. Now I have to use devicemotion. I need to rotate the camera when device moves. Not just rotate a certain angle. (Not just device move, When […]

Measuring tilt angle with CMMotionManager

Suppose you are holding an iphone/ipad vertically in front of you with the screen facing you, in portrait orientation. You tilt the device to one side, keeping the screen facing you. How do you measure that static tilt angle using CMMotionManager? It seems a simple question which should have a simple answer, yet I cannot […]