当一个精灵被施加了如下的冲量,我该如何停止它:
player.physicsBody!.applyImpulse(CGVectorMake(50, 0))
移动是否可以在一段时间内(2秒)逐渐减少?
当一个精灵被施加了如下的冲量,我该如何停止它:
player.physicsBody!.applyImpulse(CGVectorMake(50, 0))
移动是否可以在一段时间内(2秒)逐渐减少?
//this will reset the x, y based velocity to a halt/stop
player.physicsBody?.velocity = CGVectorMake(0, 0)
//if you would also like to stop any rotation that may be present
player.physicsBody?.angularVelocity = 0
//These values should be set when creating the physicsBody.
//should experiment with these values to get the desired effect.
player.physicsBody?.linearDamping = 1.10
player.physicsBody?.angularDamping = 0.25