Search code examples
anylogic

How to check if an agent arrived at certain point node?


Hi Iam moving a truck to a point node along with a path using main.trucks.get(0).moveTo(main.nodeHill); This works successfully and now I want to check if the truck is arrived to the point node. Is there any way to check that? Thanks


Solution

  • In most cases, you would use a statechart to move the agent. One of the transition types is "on agent arrival", which is triggered when the agent arrives.

    So if you call moveTo(main.nodeHill) in your truck agent statechart's "on enter" code box, and if you have the only exit transition of type "on agent arrival", it will trigger when it arrives at nodeHill