2014년 11월 29일 토요일

Rotation of Image Sprite


I am trying to rotate image sprite in the canvas. I want it rotate in clockwise and counterclockwise based on how user drags it. What will be best approtch do this. I come up with these blocks but movement is not smooth. Sometime it stops and starts moving in opposite direction and so on. 

Any suggesation?




--
If anyone looking at blocks. Hand1 and SP1 have same heading. 

--
I have reproduced your blocks.
I get no movement at all when dragging Sp1.
What behavior should it have?

--

This is the modified logic for turning the clock hands.
It worked the best out of the methods I tried.

--
Thank a lot Scott, this is very helpful.

I still see issue moving it in CCW direction.

I considered this as 4 quadrant approach. In my blocks, I had issue
crossover from quadrant 1 to 2 and 3 to 4. i.e. crossing X axis.

With your modified blocks all 4 quadrants are identified, still the issue
of crossover remains consistent.

ONLY thing, I think will work is to define Dragged FINGER Movement = Clockwise or counterclockwise

There are two approaches I am considering :
1. Use dragged output values and mathematically refine clockwise and ccw
movement (like the one you did or I had)
2. Use dummy / hidden image sprite and define there linear movement into
angular. (I am not sure what I am taking about- but I want to put eight
image sprites - all transparent and based on which one touched first- image
will move. - isn't this same as 4 quadrant approach. May be not.

Anything else?

--

댓글 없음:

댓글 쓰기