A circular impassable area to be avoided by agents.


class GKCircleObstacle : GKObstacle


To make agents (GKAgent objects) avoid obstacles, create a goal with the init(toAvoid:maxPredictionTime:) method. Agents affected by an avoid-obstacles goal will attempt to move such that their radius never overlaps that of a circular obstacle.

To learn more about using goals and agents, see Agents, Goals, and Behaviors in GameplayKit Programming Guide.


Creating an Obstacle

init(radius: Float)

Initializes a circular obstacle with the specified radius.

Placing an Obstacle

var position: vector_float2

The position of the obstacle.

var radius: Float

The radius of the obstacle.


Inherits From

Conforms To

See Also


class GKObstacle

The abstract base class for objects representing impassable areas in a game world.

class GKSphereObstacle

A spherical impassable volume to be avoided by agents.

class GKPolygonObstacle

A polygon-shaped impassable area in a 2D game world.