Skip to content

Commit

Permalink
Improved rotation
Browse files Browse the repository at this point in the history
  • Loading branch information
Birkemose committed Jul 31, 2014
1 parent 85cc194 commit 32697f7
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion Extensions/CCSpriteMultiTouch/CCSpriteMultiTouch.m
Original file line number Diff line number Diff line change
Expand Up @@ -195,8 +195,12 @@ - (void)touchRotate
{
_rotationCentre = [self centre];
float rotation = [self rotation:_rotationCentre];
self.rotation = self.rotation - 180.0f / M_PI * (rotation - _rotationLast);
float delta = rotation - _rotationLast;
_rotationLast = rotation;
// make sure the rotation is smooth
if (delta < -M_PI_2) delta = M_PI + delta;
if (delta > M_PI_2) delta = M_PI - delta;
self.rotation = self.rotation - (180.0f / M_PI * delta);
}

//----------------------------------------------------------------------
Expand Down
Binary file not shown.

0 comments on commit 32697f7

Please sign in to comment.