Zooming an SKNode inconsistent

前端 未结 1 1596
慢半拍i
慢半拍i 2021-01-02 22:13

I have created my own solution for zooming in or out on a specific SKNode without having the zoom the entire scene, and it seems to work mostly how I would expect it to work

相关标签:
1条回答
  • 2021-01-02 22:47

    This will solve your problem, thanks to Steffen for the hints.

    - (void)didMoveToView:(SKView *)view
    {
        UIPinchGestureRecognizer *precog = [[UIPinchGestureRecognizer alloc] initWithTarget:self action:@selector(handlePinch:)];
        [self.scene.view addGestureRecognizer:precog];
    }
    
    - (void)handlePinch:(UIPinchGestureRecognizer *) recognizer
    {
        //NSLog(@"Pinch %f", recognizer.scale);
        //[_bg setScale:recognizer.scale];
        [_bg runAction:[SKAction scaleBy:recognizer.scale duration:0]];
        recognizer.scale = 1;
    }
    
    0 讨论(0)
提交回复
热议问题