---
title: "obstacles(fromSpriteTextures:accuracy:)"
framework: spritekit
role: symbol
role_heading: Type Method
path: "spritekit/sknode/obstacles(fromspritetextures:accuracy:)"
---

# obstacles(fromSpriteTextures:accuracy:)

Turns each node into an obstacle by changing the node’s texture into a physics shape and converting it into the scene’s coordinate system.

## Declaration

```swift
class func obstacles(fromSpriteTextures sprites: [SKNode], accuracy: Float) -> [GKPolygonObstacle]
```

## Parameters

- `sprites`: An array of doc://com.apple.spritekit/documentation/SpriteKit/SKNode objects.
- `accuracy`: A floating point value between 0.001 and 1.0, inclusive. Higher values create a more precise (but more complex) representation of the obstacle.

## Return Value

Return Value An array of GKPolygonObstacle objects.

## Discussion

Discussion Use the array of obstacles to create an obstacle graph (GKObstacleGraph) in GameplayKit. See GameplayKit and GameplayKit Programming Guide.

## See Also

### Adding GameplayKit Behaviors

- [entity](spritekit/sknode/entity.md)
- [obstacles(fromNodeBounds:)](spritekit/sknode/obstacles(fromnodebounds:).md)
- [obstacles(fromNodePhysicsBodies:)](spritekit/sknode/obstacles(fromnodephysicsbodies:).md)
