Reputation: 5154
I want to detect pinches on a box2d body in cocos2d iPhone, but I'm not sure where to start. The objects are simple b2cirleshapes. I know ios has the uipinchgeasture recogniser but I don't know if that's the way to go or how to implement it on a box2d object. Thanks heaps!
Upvotes: 0
Views: 428
Reputation: 199
Try this -
UIPinchGestureRecognizer *pinchGesture = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(pinchGesture:)];
[self.box2d addGestureRecognizer:pinchGesture];
WIth this -
- (void)pinchGesture:(UIPinchGestureRecognizer *)pinch {
if (pinch.velocity < 0) {
//close pinch
}
else {
//open pinch
}
}
Upvotes: 1