views:

663

answers:

1

Hi to all

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.

+1  A: 

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

Mark Bessey