Type Method

obstaclesFromNodePhysicsBodies:

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

Declaration

+ (NSArray<GKPolygonObstacle *> *)obstaclesFromNodePhysicsBodies:(NSArray<SKNode *> *)nodes;

Parameters

nodes

An array of SKNode objects.

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

obstaclesFromNodeBounds:

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

obstaclesFromSpriteTextures: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.