Question

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.

Was it helpful?

Solution

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

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top