Agent Animation Rotation

AnyLogic supports different types of agent animation rotation during movement and several methods for flexible rotation configuration. Rotation towards movement is always enabled by default in the agent type properties. 

  To configure rotation of the agent

  1. Open the properties of the agent type by clicking it in the Projects view.
  2. Open the Movement section of the properties.
  3. The option Rotate animation towards movement is enabled by default; you can uncheck it, if you want to control rotation manually, for instance, with attractors
  4. If you want the agent animation shape to be rotated vertically, select the corresponding checkbox.

You can define agent's animation rotation upon arrival with the help of attractors.

Rotation functions

void setRotation( double rotation ) - sets the rotation (angle in radians) of the agent animation in continuous 3D space or GIS space. Depending on automatic rotation setting, this rotation value may be overridden during the next call of moveTo() or during current movement (if any exists).
Parameters:
rotation - the rotation angle of the agent in radians (measured from animation point (1, 0), CW around (0, 0) point). 

double getRotation() - returns the current rotation angle (in radians) of the agent in continuous 3D space or GIS space. The rotation changes each time the agent starts moving. Returns the current heading (orientation) of the agent in radians, 0 is 3 o'clock, clockwise. When the agent starts moving, its heading is set in the direction of movement.

void setAutomaticHorizontalRotation(boolean yes) - tells agent to rotate automatically during movements.
Parameters:
yes - true - agent will be rotated during movement, false - rotation will not be changed

boolean isAutomaticHorizontalRotation() - returns true if agent is set to be rotated during movement, false otherwise.

void setVerticalRotation(double rotation) - sets the vertical rotation (angle in radians), along Z-axis of the agent animation in 3D space. Depending on automatic vertical rotation setting, this rotation value may be overridden during the next call of moveTo() or during current movement (if any exists) along path.

double getVerticalRotation() - returns the current vertical rotation angle of the agent in 3D space around Y axis (CW from +Z to +X). If automatic vertical rotation mode is set, the rotation changes each time the agent starts moving and also changes multiple times during movement along path.

void setAutomaticVerticalRotation(boolean yes) - tells agent to rotate automatically (in vertical direction, along Z-axis) during movements in 3D.
Parameters:
yes - true - agent will be rotated during movement (e.g. box travelling on conveyor slope), false - rotation will not be changed (e.g. passenger going upstairs).

boolean isAutomaticVerticalRotation() - Returns true if agent is set to be rotated (in vertical direction, along Z-axis) during movement in 3D, false otherwise.
Parameters:
true if agent will be rotated during movement (e.g. box travelling on conveyor slope), false - rotation will not be changed (e.g. passenger going upstairs)


Related topics

Agent animation