Contents

applyTorque(_:duration:)

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

Declaration

class func applyTorque(_ torque: CGFloat, duration: TimeInterval) -> SKAction

Parameters

  • torque:

    The amount of torque, in Newton-meters.

  • duration:

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

Return Value

A new action object.

Discussion

When the action executes, the torque is applied continuously to the physics body for the duration of the action. This action generates an angular acceleration on the body without causing any linear acceleration.

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

See Also

Animating Properties of a Node’s Physics Body