This is the sample application to rotate the arrow pointer based on the touch point below is the logic for rotating a view according to touch point and you can download the source at https://github.com/chandanshetty01/RotateArrow
#define CC_RADIANS_TO_DEGREES(__ANGLE__) ((__ANGLE__) * 57.29577951f) // PI * 180
-(float32) getRotatingAngle : (CGPoint)firstPoint secondPoint:(CGPoint)secondPoint
{
float dx = firstPoint.x - secondPoint.x;
float dy = firstPoint.y - secondPoint.y;
float angle = CC_RADIANS_TO_DEGREES(atan2(dy, dx));
return angle;
}
No comments:
Post a Comment