Contents

noiseField(withSmoothness:animationSpeed:)

Creates a field node that applies a randomized acceleration to physics bodies.

Declaration

class func noiseField(withSmoothness smoothness: CGFloat, animationSpeed speed: CGFloat) -> SKFieldNode

Parameters

  • smoothness:

    The smoothness of the noise used to generate the forces. This parameter should be a value between 0.0 and 1.0, where 1.0 represents a uniform smoothness.

  • speed:

    The speed at which the noise field should change. A value of 0.0 means that the field should not animate at all.

Return Value

A new noise field node.

Discussion

Use a noise field to simulate effects such as fireflies or snow.

The acceleration is proportional to the field strength in a pseudo-random direction. The calculated force is proportional to the physics body’s mass (meaning that the acceleration applied to all affected physics bodies is a constant).

See Also

Creating Field Nodes