In Cocos2d while using the UIPinchGestureRecognizer
, how do you get the pinch coordinates?
Asked
Active
Viewed 630 times
3
2 Answers
2
-(void)handlePinchFrom:(UIPinchGestureRecognizer*)recognizer
{
// How to get the coordinates.
CGPoint touchLocation = [recognizer locationInView:recognizer.view];
touchLocation = [[CCDirector sharedDirector] convertToGL:touchLocation];
touchLocation = [self convertToNodeSpace:touchLocation];
// How to get the scale.
float scale = recognizer.scale;
}
... assuming that self
is your scene.

Danyal Aytekin
- 4,106
- 3
- 36
- 44
-
Thanks Danyal, this gave me the midpoint of the pinch was hoping for the finger locations any ideas??? – Rhuntr Dec 01 '11 at 01:57
-
Not sure but one of the answers here discusses it. http://stackoverflow.com/questions/5311197/uipinchgesturerecognizers-touch-locations – Danyal Aytekin Dec 01 '11 at 09:04
0
There's also some gesture code in CMMSimpleFramework. A bit hard to separate - but overall nice work. https://github.com/kimbobv22/CMMSimpleFramework