Phase 3. Creating 3D animation

You’ve now seen many of the features that help make AnyLogic such a powerful modeling tool. But there are others you haven’t touched, and one of the most exciting is 3D animation.

Introducing Camera Objects

AnyLogic’s camera objects allow you to define the view that displays in the 3D window. In essence, the camera object "shoots" the picture that you see.

You can also create several camera objects to show different areas of the same 3D scene or to show a single object from different points of view. If you use more than one camera object, you can easily switch from one view to another at runtime.

  1. On the Presentation  palette, drag the Camera  object on to the Main diagram so it faces the job shop layout.
  2. Drag the 3D Window  element on to the Main diagram, and then place it below the process flowchart.

3D Window

In addition to having the option to add several cameras to your model, you can also add several 3D windows that will each display the same 3D scene from a different point of view.
  1. Let the camera "shoot" the picture for the 3D window. In the 3D window’s Properties area, click camera in the Camera list.
  2. Prevent the camera from shooting the picture from under the floor by selecting the option Limited to Z above 0 from the Navigation type list.

  3. Run the model.

    When you create a 3D window, AnyLogic adds a view area that allows you to easily navigate to the 3D view at runtime. To switch to this 3D view while the model is running, open the developer panel by clicking the Developer panel  control in the right corner of the control panel. In the developer panel, expand the  select view area to navigate list and select [window3d] from the list.

  1. The view area expands the 3D animation scene to the model window's full size.
    Do one or more of the following to navigate in 3D at runtime:
    1. To move the camera left, right, forward or backward, drag the mouse in the selected direction.
    2. To move the camera closer to or further from the scene's center, rotate the mouse’s wheel.
    3. To rotate the scene relative to the camera, drag the mouse while you press and hold ALT (Mac OS: Option key) and the left mouse button.
  2. Choose the view you want to display at runtime, right-click (Mac OS: CTRL+click) inside the 3D scene, and then click Copy the camera’s location.

  3. Close the model’s window.
  4. On the camera’s Properties area, apply the camera location you selected during the previous step by clicking Paste coordinates from clipboard.


    NOTE: If you can’t locate the camera, you can use the Projects tree. It will display camera under the Main agent’s Presentation branch.

  5. Run the model to view the 3D view from the new camera position, and then close the model window. 
  6. Expand the Space Markup palette’s Pedestrian area and then double-click the Wall  element’s icon to enable wall drawing mode.

  7. Do the following to draw walls around the job shop layout’s working area:
    1. Click the position in the graphical editor where you want to start drawing the wall.
    2. Move the pointer in any direction to draw a straight line, and then click at any point where you want to change direction.
    3. Double-click at the point where you want to stop drawing the wall.

  8. Do the following to change the wall’s fill color and texture:
    1. On the wall’s Properties area, expand the Appearance section.
    2. In the color menu, click Other colors.
    3. In the Colors dialog, select the color that you want to apply to the wall from the palette or the spectrum.

      You can also set a transparency level (use Transparency slider in the Colors dialog) or customize the wall with any provided texture (click the Textures… item in the colors menu).

    In this section, we’re using walls to decorate our model. In the pedestrian Airport tutorial you’ll see how walls can also be obstacles.

  9. Go to the wall’s Position and size section and change the Z-Height to 40.

    AnyLogic automatically sets the shape's height to 20 pixels to ensure it has volume in a 3D view, but we’ve now increased its height to 40 pixels.

  10. Draw another wall between the exits and then change the settings in the second wall’s Properties area to match the first wall.

  11. Run the model and view the 3D animation.

    You’ll see that our model’s animation uses cylinder shapes to represent pallets, but we’ll correct the problem by creating an agent type that defines a custom animation for pallets.

  12. In the sourcePallets block’s Properties area, under the New agent list, click the create a custom type link.

  13. In the New agent wizard, do the following:
    1. In the Agent type name field, type Pallet.
    2. Click Next.

    3. On the next page of the wizard, expand the Warehouses and Container Terminals section in the list on the left, and then click the 3D animation figure Pallet
    4. Click Finish.


    AnyLogic creates the Pallet agent type and opens the Pallet diagram that will display the animation that we selected in the wizard. Our next step will be to add product animation on top of the pallet animation, but we’ll first enlarge the view to give us a closer look at the pallet.

  14. Using the Zoom toolbar, enlarge the Pallet diagram to 500%, and then move the canvas to the right and down to view the axis’ origin point and pallet animation shape.

Enlarging or reducing the view

AnyLogic’s Zoom toolbar lets you enlarge or reduce the view of a graphical diagram:


  1. Do the following to start adding product animation on top of the pallet animation.
    1. On the 3D Objects palette, expand the Boxes area.
    2. Drag the Box 1 Closed object on to the pallet’s upper-left corner.

  2. Since this box appears to be too large when compared to the pallet, let’s change the box’s Scale to 75%.

  3. In the box’s Properties area, expand the Position section, and then change the box’s Z coordinate to 2.

    Our change reflects the fact that we want to place boxes on the pallets and each pallet’s height is about 2 pixels.

  4. Add three boxes by copying the first box three times. To copy the box, select it and then press and hold CTRL as you drag the box.

    Our pallet now has four closed boxes, and you can now change the zoom level back to 100% by clicking the toolbar’s Zoom to 100%  button.

  5. Return to the Main diagram.

    If you open the sourcePallets block’s Properties area, you’ll see Pallet is selected as New agent. This block will generate agents of the Pallet type.

  6. Run the model.

    You’ll see pallet shapes have replaced the multicolored cylinders. However, if you zoom in the 3D scene, you’ll notice that the forklift trucks aren’t transporting pallets. We’ll correct this problem by moving our model’s pallet animation in a way that allows the forklift trucks to pick up the pallets.

  7. In the Projects view, double-click the ForkliftTruck agent type to open its diagram and then move the forkliftWithWorker figure one cell to the right.

    The animation shape is now in the correct location and our model’s pallets are aligned with the forklift trucks’ forks.

  8. Open Main diagram, and in the pallet rack’s Properties area, in the Number of levels box, type 2.

    TIP: Remember that your first click will select the network and your second click will select the network element.

  9. In the storeRawMaterial flowchart block’s Properties area, set the Elevation time per level parameter to 30 seconds.
  10. In the pickRawMaterial block’s Properties area, set the Drop time per level parameter to 30 seconds.
  11. Run the model and you’ll see a pallet rack with two levels.

Reference model: Job Shop - Phase 3


          Phase 2. Adding resources

          Phase 4. Modeling pallet delivery by trucks