Contents

applyForce(_:at:duration:)

Creates an action that applies a force to a specific point on a node’s physics body.

Declaration

class func applyForce(_ force: CGVector, at point: CGPoint, duration: TimeInterval) -> SKAction

Parameters

  • force:

    A vector that describes how much force is applied in each dimension. The force is measured in Newtons.

  • point:

    A point in scene coordinates that defines where the force is applied to the physics body.

  • duration:

    The duration over which the force is applied to the physics body.

Return Value

A new action object.

Discussion

When the action executes, the force is applied continuously to the physics body for the duration of the action. Because the force is applied to a specific point on the body, it may impart both linear acceleration and angular acceleration.

This action is reversible; it applies an equal force in the opposite direction.

See Also

Animating Properties of a Node’s Physics Body