I'm trying to build a pinball game with spritekit. The ball is affected by gravity and reacts properly, but I can't figure out a way to move the flippers so that they affect the ball's physics. Right now I'm rotating the flippers around an anchor with an SKAction like so
//set anchor point to left edge for rotation
theLeftFlipper.anchorPoint = CGPointMake(0,0.5);
//rotate (done in touchesBegan)
SKAction *rotateLeft = [SKAction rotateByAngle: -1.5f duration:0.1];
[leftFlipper runAction:rotateLeft]
I'm using this to toggle the flipper as up or down around a pivot on its edge, as would be expected with a normal pinball machine's flippers. There are two problems with this. First, the physicsBody of the flipper isn't actually moved to match up with the new anchor of the flipper, so the physics body isn't in the same location as the rendered flipper. Second, when rotating with an action the ball's position is affected but not it's velocity so hitting the ball with the flipper doesn't shoot it upwwards. Is there a better way to achieve this?