What is the theory behind the pinch zoom in and out technique used on the iPhone?? How would one do this? Do you get the distance between 2 touch points and measure them? can someone point me in the right direction :)
Here is the end code, it works for zooming in and out as well as moving around the iPhone, good usage in IOS games
Basically, you calcualte and store the distance between touches at the start of the zoom, and compare it to the distance between them to determine the zoom level along the way.
Calculating the distance between two touches is easy...
Then you'll calculate the basic scaling factor something like this...
this can be applied in several different ways depending on your project. In a a third-person perspective view, you might use this factor to adjust the distance of the camera from the object. With an orthographic camera, you would apply it to the camera's orthographicSize. In a first-person game for a sniper scope, you'd probably want to apply it to the camera's field of view. In most cases you could probably apply by just multiply it with the original value of those varibles before the pinch zoom started, ex, for orthographic camera...
Hope this helps!
answered Nov 20 '11 at 02:35 AM