Instance Property


The current position of the agent in 2D space.


@property(nonatomic, assign) vector_float2 position;


The agent updates its own position, rotation, and velocity according to its goals when you call its updateWithDeltaTime: method.

However, you can still directly change the position of an agent. Do this when you want to set the position of a static agent (that is, one with no goals) or move an agent as a direct result of user input. For example, to make a game character follow a touch (in iOS) or the mouse pointer (in macOS), you can create an invisible agent and continually update that agent’s position to match that of the touch or mouse event. Then, give the agent representing the game character a goal created with the goalToSeekAgent: method, targeting the invisible agent.

See Also

Managing an Agent’s Position and Orientation


The rotation of the agent around the z-axis.