Pinch gesture for box2d body / cocos2d sprite
我想检测cocos2d iPhone中box2d身上的捏,但我不确定从哪里开始。对象是简单的b2cirleshapes。我知道ios具有uipinchgeasture识别器,但我不知道这是解决问题的方法还是如何在box2d对象上实现它。
谢谢堆!
尝试一下-
1 2 | UIPinchGestureRecognizer *pinchGesture = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(pinchGesture:)]; [self.box2d addGestureRecognizer:pinchGesture]; |
与此同时-
1 2 3 4 5 6 7 | - (void)pinchGesture:(UIPinchGestureRecognizer *)pinch { if (pinch.velocity < 0) { //close pinch } else { //open pinch } |
} ??