I’m trying to get a vector from a UIPanGestureRecognizer, about the axes of the screen in Portrait Orientation. I know I can get the velocity, which is half of the battle, but I’d ideally like a means of getting an angle (compass degrees or radians) about the vertical axis of the screen. For example, a drag from lower-left to upper-right would be a 45 degree angle, top to bottom would be 180 degrees, or bottom to top would be 0 (or 360).
Is this possible? It doesn’t have a direction property and the explanation of translation in the docs is a little confusing. Would I need to create a center point manually (about the center of my view), and compare the start/end points of the Pan Touch to that? I’m a little unsure of the math needed.
Thanks in advance! ^_^
If you can get the velocity with :
then you can calculate the angle with respect to the x-axis with: