Creates an action that applies a torque to a node’s physics body.
SDKs
- iOS 9.0+
- macOS 10.11+
- Mac Catalyst 13.0+
- tvOS 9.0+
- watchOS 2.0+
Framework
- Sprite
Kit
Declaration
class func applyTorque(_ torque: CGFloat, duration: Time Interval) -> SKAction
Parameters
torque
The amount of torque, in Newton-meters.
sec
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.