Y touch position converted to angle?
![jonnyDiamond](http://forums.gamesalad.com/applications/dashboard/design/images/defaulticon.png)
HI,
I want to be able to rotate an actor to an angle based on the Y position of a touch.
So, the higher the user touches on the Y axis, the closer to 359 degrees the actor rotates. The lower the touch, the closer to 0 degrees.
I have been trying to use - Rotate To Angle - but I don't know how to use vectorToAngle for just the Y.
Thanks a lot
I want to be able to rotate an actor to an angle based on the Y position of a touch.
So, the higher the user touches on the Y axis, the closer to 359 degrees the actor rotates. The lower the touch, the closer to 0 degrees.
I have been trying to use - Rotate To Angle - but I don't know how to use vectorToAngle for just the Y.
Thanks a lot
Comments
I'm assuming your screen height is 320. If something else, change the 320 below to your screen height.
Rotate to Angle, with angle as follows:
=(game.touches.touch1.Y/320)*359
This will make your actor rotate in a full circle depending on how high in the scene your touch is. I recommend doing it "relative to scene".
Basically, you're looking for the angle to be calculated as a fraction of the screen height specified by the touch, if I understand you correctly. To create a fraction of the height, divide the height of the touch by the total height. To determine how far around the circle to rotate, multiply this fraction by the full circle, or 360 degrees.