用SpriteKit中的touchesMoved旋转奖金轮

是否有可能使用applyAngularImpulse而不是指数级地增加车轮的速度?
理想情况下,我想让车轮沿着我的手指,但是设置node.zRotation += atan2f(y2-y1, x2-x1)我的车轮失去控制。 这就是我所定下的,但感觉非常不可思议:

 - (void) touchesMoved:(NSSet *)touches withEvent:(UIEvent *)event { UITouch *touch = [touches anyObject]; SKNode *node = [self nodeAtPoint:location]; CGPoint positionInScene = [touch locationInNode:self]; CGPoint previousPosition = [touch previousLocationInNode:self]; [node.physicsBody applyAngularImpulse:(previousPosition.x - positionInScene.x) * 0.1]; node.physicsBody.angularDamping = 1; } 

场景: https : //dl.dropboxusercontent.com/s/gexfburjm1coude/Screen%20Shot%202014-10-21%20at%2010.30.31%20PM.png?dl = 0

应用你的冲动之后:

 [node.physicsBody applyAngularImpulse:theImpulse]; 

只需将angular速度调整到最大速度,其数值取决于您希望轮子旋转的速度。

 const CGFloat maxAngularVelocity = 2.5; node.physicsBody.angularVelocity = MIN(node.physicsBody.angularVelocity, maxAngularVelocity);