我試圖找出爲什麼我的縮放在我的OpenGL相機上表現得非常奇怪。 它的目的是放大和縮小,但其縮放非常隨機。捏(縮放)手勢不正確縮放
繼承人我的代碼:
- (void)pinchDetected:(UIPinchGestureRecognizer *)pinchRecognizer
{
NSLog (@"%@", @"Pinching");
if (pinchRecognizer.state == UIGestureRecognizerStateBegan ||
pinchRecognizer.state == UIGestureRecognizerStateChanged ||
pinchRecognizer.state == UIGestureRecognizerStateEnded) {
currentScale = pinchRecognizer.scale;
}
if(lastScale < currentScale) {
_camera.z += currentScale * 0.01f;
lastScale = currentScale;
}
if (lastScale > currentScale)
{
_camera.z -= currentScale * 0.01f;
lastScale = currentScale;
}
}
它隨時改變的,所以它基本上不會以連續因子進行縮放。如果這是有道理的? – JavaCake 2012-03-13 21:10:07