Type Method

obstacles(fromSpriteTextures:accuracy:)

Converts each node into an obstacle by first transforming the node’s texture into a physics shape and then converting that shape into the scene’s coordinate system.

Declaration

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

Parameters

sprites

An array of 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

An array of GKPolygonObstacle objects.

Discussion

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

See Also

Creating GameplayKit Obstacles from a Set of Nodes

class func obstacles(fromNodeBounds: [SKNode])

Converts each node into an obstacle by transforming its bounds into the scene’s coordinate system.

class func obstacles(fromNodePhysicsBodies: [SKNode])

Converts each node into an obstacle by transforming the node’s physics body shape into the scene’s coordinate system.