【发布时间】:2015-01-06 19:15:03
【问题描述】:
如何在触摸事件中旋转 SpriteNode?p>
到目前为止的代码如下:
// Detect what side of the screen the user has touched.
if(touchLocation.x < 160) {
// They've touched the left side (the car turns left)
[car runAction:[SKAction rotateByAngle:-50 duration:0]];
[car.physicsBody applyImpulse:CGVectorMake(-20,0)];
car.physicsBody.velocity = CGVectorMake(-20, 0);
}else{
// They've touched the right side (the car turns right)
[car runAction:[SKAction rotateByAngle:50 duration:0]];
[car.physicsBody applyImpulse:CGVectorMake(20,0)];
_bird.physicsBody.velocity = CGVectorMake(20, 0);
}
-50 的轮换不起作用,即使其他 Stackoverflow 问题已将其作为可接受的答案。此外,正常工作的 50 度转弯似乎在瞬间起作用,然后恢复到原来的位置。
如何让旋转保持平稳并平稳旋转?
【问题讨论】:
标签: ios rotation sprite-kit game-physics