Scaling agent animations on
Defining the agent's animation scale
When you create some custom type of agents in your model, you
typically assign animation for this type of agents. Say,
you created Truck agent type, and chose 2D Lorry animation shape in the New agent wizard.
If you open the Truck agent diagram, you can set the scale for the agent animation shape using the Scale element. Scale element is present on each agent diagram by default (above the X-axis).
Say, the truck length is 7 meters. So you should make the scale ruler of the same length as the truck shape, and then in the properties of the scale element set Ruler length corresponds to: 7 meters.
Setting different animation scales for different GIS map scales
At model runtime, if you have not zoomed GIS map enough, you
will not be able to see agents in their real size, their animations
will be too small.
That is why AnyLogic allow users to tune how to scale the agent
animation depending on the current GIS map scale. Typically,
you may want to hide agents when the map is not zoomed in enough,
display agents at some fixed size at medium map scales, and
use real agent size when the map is zoomed close enough.
set the agent's animation scaling rules
- On the graphical diagram where the GIS map is placed (e.g. Main), select the embedded presentation of the agent:
- Go to the Position and size
properties section. Set the Scale is: Automatically calculated option.
- Below the option, set two settings. First, define the map zoom up to which the real size of the agent animation will be shown
(the Real size when map is under
option, the default value is 1:1000). This means that in our case
when GIS map will be zoomed closer than the defined scale value, truck
shape will be scaled to be 7 meters long according to the current GIS
map scale. If it is not easy to find out the appropriate map scale
value for this setting, you can zoom GIS map to the desired scale in the graphical editor, and then choose this scale by clicking the button Use current map scale to the right of the option.
- The next setting (Fixed size when map is under)
defines the GIS map scale when the truck shape will be displayed with
the fixed size (the size of the animation shape on its diagram, Truck).
So probably you may want to reduce the truck animation there. Now, on
medium map scales, trucks will always be animated with shapes of this
- If it is not easy to find out the appropriate map scale value for this setting, you can also zoom GIS map to the desired scale, and then Use current map scale (click the similar button to the right of this option).