Questions tagged [cmmotionmanager]

Use for questions regarding CMMotionManager objects; an NSObject class in the Core Motion framework and MonoTouch.CoreMotion Namespace.

CMMotionManager is an NSObject class in the Core Motion framework and MonoTouch.CoreMotion Namespace.

A CMMotionManager instance provides access to motion services and data, including accelerometer and magnetometer data.

Motion services are not available on all devices -- the deviceMotionAvailable boolean property indicates whether or not motion services are available.

Resources

152 questions
38
votes
4 answers

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?…
millport
  • 2,411
  • 5
  • 23
  • 19
13
votes
3 answers

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.…
ronan
  • 1,611
  • 13
  • 20
13
votes
3 answers

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…
Spispeas
  • 151
  • 1
  • 7
11
votes
2 answers

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)…
Naitian
  • 113
  • 1
  • 1
  • 4
8
votes
2 answers

CMMotionManager not producing any .deviceMotions

Im working on a AR app for my company, and it is working smoothly, except on around one out of ten devices. (all iphone 4 and 4s, 5.1.1+) When we run this code : CMDeviceMotion *d = motionManager.deviceMotion; if (d == nil &&…
Nils Munch
  • 8,805
  • 11
  • 51
  • 103
7
votes
4 answers

CMMotionactivitymanager authorizationstatus

I want to get the authorization status for CMMotionActivityManager. For other services like calendar and location we have some property in the API that gives us the user authorization status for these classes. How i can get the authorization status…
Madu
  • 4,849
  • 9
  • 44
  • 78
5
votes
1 answer

motion manager not working

I'am trying to get the device motion (pitch,roll,yaw) but my function handleDeviceMotionUpdate isn't launched (I'am trying it on an iphone 5s) , here is the code : import UIKit import CoreMotion class ViewController: UIViewController { override…
Theilya
  • 69
  • 11
5
votes
1 answer

Please help me correctly apply device rotation data

So I have a bit of a project I am trying to do. I am trying to get the devices rotation relative to gravity, and translation from where it started. So basically getting "tracking" data for the device. I plan to basically apply this by making a 3d…
J.Doe
  • 1,502
  • 13
  • 47
5
votes
1 answer

Strange behavior of Core Motion's accelerometer implemented in the background mode

I'm implementing a pedometer on iOS. An important requirement is it must work even if the app were to put in the background mode (e.g., a device is locked or a user presses the home button). You can see such implementation in the App Store like…
5
votes
2 answers

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…
user1073400
4
votes
1 answer

Find the direction of motion?

I have an image(floor plan) where i pinned my current position. with CMPedometer I am able to find the number of steps moved but couldn't find the direction in which i am moving. if(CMPedometer.isStepCountingAvailable()){ …
Stephen
  • 3,359
  • 4
  • 20
  • 30
4
votes
0 answers

How to reset `CMMontionManager`'s `attitude`

I want to reset CMMotionManager's attitude so the rotationMatrix points to the "front" (that is, the device rotation around the gravity axis it's at its default position). This is the behavior when you call -startDeviceMotionUpdates on a disabled…
4
votes
2 answers

CMMotionData to SceneKit SCNNode orientation

Trying to use CoreMotion to correctly rotate a SceneKit camera. The scene I've built is done rather simple ... all I do is create a bunch of boxes, distributed in an area, and the camera just points down the Z axis. Unfortunately, the data coming…
4
votes
3 answers

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…
lisovaccaro
  • 32,502
  • 98
  • 258
  • 410
4
votes
2 answers

CMMotionManager vs UIAccelerometer efficiency

I've been working on an AR framework for a while now and am trying to update from UIAccelerometer (deprecated) to CMMotionManager but am running into some efficiency problems? Basically it seems like CMMotionManager is MUCH larger and slower than…
glesage
  • 955
  • 2
  • 16
  • 31
1
2 3
10 11