Not sure if this is the most appropriate sub forum choice, possibly maths or mobile but here we go.
Unfortunately not quite as simple as the title suggests; I have an app and at the basic level I just have a quad that I wish to move around. Dragging it around with 1 finger is easy. Zooming via pinch using 2 fingers is also easy enough. Dragging around using both fingers while zooming was awkward but I managed it a bit. Dragging around with 2 fingers then releasing, then dragging with one finger then zooming out then dragging with two fingers etc.. that's where I am getting stuck. I managed to get it working quite well but when zoomed in and I touch both fingers it causes a jump. Basically it got very complicated very fast and the more edge cases I try to deal with the more complex it becomes. I am hoping for some general advice of how to deal with this.
Some points/thoughts:
What 'space' should I work in? I have been working in screen space (-1+1, -1+1) but my quad actually represents a different space itself so I could work in that space instead.
I need to be able to zoom in on the centre of the 2 fingers rather than the origin.
How do I store my values? position and scale or as a transform matrix (it will end up being a matrix, I can extract position/scale from the matrix if I need to).
When zooming I found I needed to have an extra zoom variable that was temporarily applied while using two fingers then permanently applied when I released (this made things messy).
Translation need to go slower when zoomed and faster when zoomed out.
I have good input events, when something is touched, released, dragged and with pointer indices too so actually getting and understanding the input is simple.
Any advice on how I can implement this in a clean way? As long as I zoom on the origin rather than on the centre of the two touch points I can do this without issue but I need that.
Thanks.