Jyotsna
Jyotsna

Reputation: 4441

How to find Angle of Rotation of iphone?

I want to calculate angle of rotation when I am rotating the iphone from portrait mode to Landscape right or Landscape left but in YX plane. In my game I want to rotate one object respect to iphone but in opposite direction. If I will move iphone from portrait mode to Landscape right by 30 degree then I want to move object 30 degree only but to landscape right. I have formula of dot product like

v1.v2=L1.L2cos(θ) but i dont know the exact solution so. So if any one know it please help me out Thanks in advance.

Upvotes: 1

Views: 1541

Answers (1)

Mark Bessey
Mark Bessey

Reputation: 19782

You'll probably find the atan2() standard library function useful. It'll convert the x and y acceleration figures into an angle for you.

Upvotes: 1

Related Questions