AnyLogic
Expand
Font size

Animating pedestrians

Standard 2D animation

By default, pedestrians are animated as small circles of different colors. Circle radius reflects radius of the pedestrian. You can change the color of this circle whenever you need. For instance, to make the shape red, type ped.setColor(red); in On exit parameter of the required Pedestrian Library flowchart block. We do not recommend to use any other custom shapes for animating pedestrians in 2D since your shape will not correspond to the physical size of a pedestrian.

Custom 3D animation

You can animate pedestrians with any 3D objects. Choose one of ready-to-use 3D shapes of people when creating a custom pedestrian type right in the New agent wizard, or if you need some other 3D shape, load it using the element 3D object.

If you want to use e.g. 3D object Person and change the color of pedestrians’ shirts, you can follow the technique described in Painting standard and imported 3D objects.

AnyLogic will detect if the animation figure you are using to animate a pedestrian is 2D or 3D, and if it is 3D animation figure, it will display it in the 3D window.

If you need, you can use different shapes for 2D and 3D: e.g. draw a circle (and set Show in: 2D only in its Advanced properties), and also add a 3D object and set Show in: 3D only for it.

Demo model: Subway Entrance Hall Open the model page in AnyLogic Cloud. There you can run the model or download it (by clicking Model source files).

In this demo model pedestrians created by different sources are animated with different 3D objects. There are several different 3D objects on Passenger diagram in the axis origin, each object has its own dynamic value specified in the Visible property, for example: appearanceType == 4, where appearanceType is the passenger’s parameter with values generated randomly according the probability distribution call: uniform_discr(0, 6).

How can we improve this article?