John
John

Reputation: 67

How do I get the next node id/name along the path the agent is moving?

Assume that an agent is moving from Node1 to Node3 in the following network: Node1 - PathA - Node2 - PathB- Node3 How do I access the next node the agent will pass?

The actual task it for bus agents to move along the yellow paths and pickup/drop off passengers and crews at the corresponding stands (nodes) - one of the tasks requires me to acquire the "next node".

nodes and paths at airport

Upvotes: 0

Views: 156

Answers (2)

Benjamin
Benjamin

Reputation: 12795

If you want full control of path-finding and nodes, check this tutorial. Fair warning: this is quite advanced and goes well beyond AnyLogic basics: https://www.benjamin-schumann.com/blog/2022/8/6/taking-control-of-your-network-agent-based-pathfinding

Upvotes: 1

Felipe
Felipe

Reputation: 9421

When you define a destination node, the only thing you can access once your agent starts moving is the destination position using getTargetX() for instance.

Nevertheless, AnyLogic doesn't give you access to the set of nodes the agent will use on its movement.

Upvotes: 0

Related Questions