- Home /
Transform 2d object by two points gained from touch
Hi,
Could someone explain or give a code example how to make 2d gameobject transform (canvas ui image) in that way:
when you put two fingers on gameobject, remember local positions where fingers touches the gameobject.
when you are moving fingers on screen (any finger, both fingers, any direction), they pointing into the same points of gameobject all the time, but game object transforms (rotates, scale, move).
I know, that can be achieved by calculating separately distance, angle and scale, but my question is, is there any mathematical way to gain such translations into one mathematical formula?
Ideal example of this is a Android Google Maps Application, as you can see in this app, when you touch screen with two fingers, whatever you do (rotate, scale, move), that fingers always pointing to the same points. How to achieve such behaviour?
Can someone help me with this?
Your answer
Follow this Question
Related Questions
Looking at a target in 2D 0 Answers
Dragging a 2D sprite with touch 1 Answer
Move object by touch input 5 Answers
Stop Moving When Not Touching Screen? 1 Answer
Change Input.GetTouch(0).deltaPosition to object transform position in Unity 4.3 for 2D 3 Answers