Two fingers rotation of an object

hello all.

does anybody know of a library/code/solution that would show me how to implement a two fingers rotation of an object ?

I’d like to be able to touch an object with two fingers and then rotate it clockwise or counter-clockwise depending on the fingers movements

thank you! [import]uid: 95911 topic_id: 17071 reply_id: 317071[/import]

Take a look at the multitouch sample code that comes bundled with Corona, it has examples of pinch-to-zoom and things like that. If you just changed it to modify the .rotation property rather than the scale property, along with some other minor tweaks, I’m sure you could accomplish two-finger rotation fairly easily.

That is, if you’re comfortable with SINGLE touches first. If not, I’d suggest familiarizing yourself with exactly how single-touches are handled, and become well-versed in that before attempting to look at multi-touch (it can get confusing if you don’t understand touch events to begin with). [import]uid: 52430 topic_id: 17071 reply_id: 64105[/import]

@rbhfst,

in pseudo code here’s how you can acomplish it

get the touch, each touch is identified by it’s own ID, so you will know which touch is which.

now if you are using the two fingers to rotate, then you would have two moved events, check for the position of the last touch for that id and the current position for that touch. You will get a dMove (difference of the touches) and the two touches *should* be exactly opposite of each other. if one is increasing, then the second should decrease.

 ,-----.,-. \
 ,' (`1 ) `.
^ ,' `-'. \
| ; : :
| | | |
| ;-. ; v
: ( 2.) ,'
 \ `-'`. ,'
 `--- `-----'

now you can rotate the object with that delta.

cheers,

?:slight_smile:
[import]uid: 3826 topic_id: 17071 reply_id: 64142[/import]

thank you for the replies. I understand how single touches work (touch, tap, began, moved, ended, listener)

But now I am ready to learn more about multi touches. So again thanks for the suggestions. I am going at it starting this Monday.
Awesome illustration btw. :slight_smile: [import]uid: 95911 topic_id: 17071 reply_id: 64177[/import]