---
title: "velocityField(with:)"
framework: spritekit
role: symbol
role_heading: Type Method
path: "spritekit/skfieldnode/velocityfield(with:)"
---

# velocityField(with:)

Creates a field node that sets the velocity of physics bodies that enter the node’s area based on the pixel values of a texture.

## Declaration

```swift
class func velocityField(with velocityTexture: SKTexture) -> SKFieldNode
```

## Parameters

- `velocityTexture`: A normal texture used to specify the velocities at different points in the field.

## Return Value

Return Value A new velocity field node.

## Discussion

Discussion When a physics body is affected, its new velocity in each frame is calculated by performing a texture lookup (treating the value as a normal vector) and then multiplying that vector by the strength of the field. The field has an implicit size (region) equal to the size of the texture; physics bodies outside this area are unaffected by the field node.

## See Also

### Creating Field Nodes

- [dragField()](spritekit/skfieldnode/dragfield().md)
- [electricField()](spritekit/skfieldnode/electricfield().md)
- [linearGravityField(withVector:)](spritekit/skfieldnode/lineargravityfield(withvector:).md)
- [magneticField()](spritekit/skfieldnode/magneticfield().md)
- [noiseField(withSmoothness:animationSpeed:)](spritekit/skfieldnode/noisefield(withsmoothness:animationspeed:).md)
- [radialGravityField()](spritekit/skfieldnode/radialgravityfield().md)
- [springField()](spritekit/skfieldnode/springfield().md)
- [turbulenceField(withSmoothness:animationSpeed:)](spritekit/skfieldnode/turbulencefield(withsmoothness:animationspeed:).md)
- [velocityField(withVector:)](spritekit/skfieldnode/velocityfield(withvector:).md)
- [vortexField()](spritekit/skfieldnode/vortexfield().md)
- [customField(evaluationBlock:)](spritekit/skfieldnode/customfield(evaluationblock:).md)
- [SKFieldForceEvaluator](spritekit/skfieldforceevaluator.md)
