Type Method

applyForce:duration:

Creates an action that applies a force to the center of gravity of a node’s physics body.

Declaration

+ (SKAction *)applyForce:(CGVector)force duration:(NSTimeInterval)duration;

Parameters

force

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

sec

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. This action accelerates the body without imparting any angular acceleration to it.

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

See Also

Animating Properties of a Node's Physics Body

+ applyTorque:duration:

Creates an action that applies a torque to a node’s physics body.

+ applyForce:atPoint:duration:

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

+ applyImpulse:duration:

Creates an action that applies an impulse to the center of gravity of a physics body.

+ applyAngularImpulse:duration:

Creates an action that applies an angular impulse to a node’s physics body.

+ applyImpulse:atPoint:duration:

Creates an action that applies an impulse to a specific point of a node’s physics body.

+ changeChargeTo:duration:

Creates an action that changes the charge of a node’s physics body to a new value.

+ changeChargeBy:duration:

Creates an action that changes the charge of a node’s physics body by a relative value.

+ changeMassTo:duration:

Creates an action that changes the mass of a node’s physics body to a new value.

+ changeMassBy:duration:

Creates an action that changes the mass of a node’s physics body by a relative value.

+ strengthTo:duration:

Creates an action that animates a change of a physics field’s strength.

+ strengthBy:duration:

Creates an action that animates a change of a physics field’s strength to a value relative to the existing value.

+ falloffTo:duration:

Creates an action that animates a change of a physics field’s falloff.

+ falloffBy:duration:

Creates an action that animates a change of a physics field’s falloff to a value relative to the existing value.