applyImpulse(_:duration:)
Creates an action that applies an impulse to the center of gravity of a physics body.
Declaration
class func applyImpulse(_ impulse: CGVector, duration: TimeInterval) -> SKActionParameters
- impulse:
A vector that describes how much momentum to impart to the body in each dimension over the duration of the action. The impulse is measured in Newton-seconds.
- duration:
The duration over which the total impulse should be applied to the physics body.
Return Value
A new action object.
Discussion
When the action executes, applies a constant force to the physics body for the duration of the action. The force is calculated by dividing the impulse strength by the duration of the action. For example, if an impulse of 1 Newton-second is applied to the physics body, and the the duration is 10 seconds, then a force of 0.1 Newtons is applied to the physics body.
This action is reversible; it applies an equal impulse in the opposite direction.
See Also
Animating Properties of a Node’s Physics Body
applyForce(_:duration:)applyTorque(_:duration:)applyForce(_:at:duration:)applyAngularImpulse(_:duration:)applyImpulse(_:at:duration:)changeCharge(to:duration:)changeCharge(by:duration:)changeMass(to:duration:)changeMass(by:duration:)strength(to:duration:)strength(by:duration:)falloff(to:duration:)falloff(by:duration:)