0
votes

I'm using Core Motion and would like to count rotations, so if i place the iphone on the table and start to rotate it clockwise and do 360 degrees, i would get 1 rotation.

What should i use from Core Motion, yaw, roll, pitch, gravity, rotationMatrix or ?

Please help me.

Cheers.

1
You'll want to use rotation on the Z-axis.Stephen Furlani

1 Answers

0
votes

You'd want to watch yaw — that's rotation around a notional line that would come straight upwards, out of the screen. It actually goes from +180 to -180, but for your purposes if you're rotating clockwise, screen upward, then you can just watch for the number to get higher instead of lower — that'll detect when the value goes beyond -180 and reappears somewhere below +180. Alternatively, look for any absolute change in value greater than, say, 180, if you want to be able to detect rotations clockwise or anticlockwise.