Hi,
I have a UIImageView representing the level of the "artificial horizon" in a plane. Blue is the sky, brown is the ground. This image is actually clipped by its super view which creates the square.
When I I move the nose of the plane up, I move the image down:
When I move the nose of the plane down, I move the picture up :
This is called the "pitch"
So far I've been modifying only the x axis of the image:
When I "roll" the plane I rotate the picture either to the left or right:
Now, the problem is that once I rotated the picture and want to modify the "pitch", I dont know which formula to use to find the correct x,y to move the picture towards the sky or ground direction:
In other words, when I rotate the picture with an angle β, what are the x, y value to add to the center of the image to move it on the red line ?
thanks for your help,
Tex
I have a UIImageView representing the level of the "artificial horizon" in a plane. Blue is the sky, brown is the ground. This image is actually clipped by its super view which creates the square.
When I I move the nose of the plane up, I move the image down:
When I move the nose of the plane down, I move the picture up :
This is called the "pitch"
So far I've been modifying only the x axis of the image:
Code:
imageHorizon.center = CGPointMake(imageHorizon.center.x, imageHorizon.center.y + valueToMove);
When I "roll" the plane I rotate the picture either to the left or right:
Code:
imageHorizon.transform = CGAffineTransformRotate(imageHorizon.transform, angleToRotate*(CGFloat)(M_PI/180));
Now, the problem is that once I rotated the picture and want to modify the "pitch", I dont know which formula to use to find the correct x,y to move the picture towards the sky or ground direction:
In other words, when I rotate the picture with an angle β, what are the x, y value to add to the center of the image to move it on the red line ?
thanks for your help,
Tex
Last edited: