Search code examples
simulationagentanylogic

How to move agent forward in Anylogic 7


Is there any function which can be used in AnyLogic 7 to move agent in a direction (angle) it faces? There are methods to move to specific cell, agent and to specific direction (East, West, North, South ...), but how can I move agent forward according angle it faces?

Similiar to fd funtction of NetLogo.


Solution

  • to my knowledge there is no method like: .moveforward()

    you could use your current position: .getXYZ() and direction: getRotation() to calculate a point some distance: r, in front of your agent and then use the .moveToStraight(x,y)

    x = r * cos(direction) + x_0

    y = r * sin(direction) + y_0