【发布时间】:2014-09-20 04:05:16
【问题描述】:
我有这样的事情:
func didBeginContact(contact: SKPhysicsContact) {
var paddle = getPaddleFromContact(contact) //of type SKPhysicsBody
var ball = getBallFromContact(contact) //of type SKPhysicsBody
if(paddle != nil && ball != nil){
//apply force to ball depending on the speed/velocity of the paddle
//NEED HELP WITH THIS LOGIC
}
}
目前用户可以通过触摸来拖动桨。它只能水平移动。我不确定哪个属性或如何根据桨的速度确定对球施加多少力。有关如何正确执行此操作的任何建议?
我尝试使用 paddle.velocity 但这些只是 0
【问题讨论】:
标签: ios swift sprite-kit game-physics