NetLogo 3D: Tutorial: 3D Movement and Orientation

NetLogo 3D Preview 5 User Manual   

Step 1: Depth

One of the first things you will notice when you open NetLogo 3D is that the world is a cube instead of a square.

screen shot

You can open up the Model Settings, by clicking on the "Settings..." button at the top of the 3D View. You'll notice in addition to max-pxcor, min-pxcor, max-pycor, and min-pycor, there is also max-pzcor and min-pzcor.

screen shot

The z-axis is perpendicular to both the x-axis and the y-axis, when you reset-perspective it is the axis that comes straight out of the screen. In the default position max-pzcor is the face of the cube nearest to you and min-pzcor is the face farthest from you. As always min-pxcor is on the left, max-pxcor on the right, min-pycor on the bottom and max-pycor on the top. You'll also notice on the left side of the Model Settings that there are options for wrapping in all three directions, however, they are all checked and grayed out. Topologies are not yet functional in 3D NetLogo so all worlds wrap in all three directions.

Is the number smaller or larger than you expected?

In a 3D World the number of patches grows very quickly since count patches = world-width * world-height * world-depth. It's important to keep this in mind when you are building your model. Lots of patches can slow your model down or even cause NetLogo to run out of memory.

Notice the shape of the patch and its position in relation to the edges of the world. You'll also notice that you now need three coordinates to address patches in a 3D world.

Step 2: Turtle Movement

Take a moment to look for the controls and monitors. In the bottom left you'll notice a group of monitors that describe the location and orientation of the turtle, though until you press the SETUP button they'll all say "N/A".

Heading, pitch, and roll are turtle variables that describe the orientation of the turtle. Heading is absolute in relation to the xy-plane, it is the rotation of the turtle around the z-axis.

screen shot

Pitch is the angle between the nose of the turtle and the xy-plane, it is relative to heading.

screen shot

Roll is the rotation around the turtle's forward vector, it is relative to heading and pitch.

screen shot

When a group of turtles are created (using crt 10 for example) the heading will be evenly spaced around the 360 degrees as in 2D NetLogo, however, pitch and roll will always be zero.

Take a look at the "Turtle Movement" buttons.

How does the turtle move? Is is the same or different from 2D NetLogo? Which of the turtle variables change?

How does the turtle move? Which of the turtle variables change?

How does the turtle move? Is it different than the last time you pressed the "left 1" button?

You probably noticed that often more than one of the turtle variables change for a single turn; for this reason we suggest that you use the turtle commands rather than setting the orientation variables directly.

Step 3: Observer Movement

At the bottom of the interface you will see a group of buttons labeled "Observer (point of view)". If you have ever used the 3D view in NetLogo 2D or if you have been using the mouse controls in the 3D view through this tutorial you have been moving the Observer. Changing the point of view in the 3D is actually moving and changing the orientation of the Observer. The Observer has x, y and z coordinates, just like a turtle or patch, while turtles and patches are constrained to be inside the world the Observer can be anywhere. Like a turtle the Observer has a heading, pitch and roll, these variables control where the Observer is looking, that is, what you see in the View.

How does the position and orientation of the Observer change?

Which of the Observer variables change? Which stay the same?

How does the view change? How do the Observer variables change?

After you are done exploring the world using the mouse controls you can take a look at the Observer control buttons in the lower left portion of the interface.

If you are familiar the latest versions of NetLogo you should be familiar with the first three buttons in the Observer group. Watch, follow, and ride, are special modes that automatically update the position and orientation of the Observer. When in follow or ride mode, the observer position and orientation are the same as the turtle's. Note that follow and ride are functionally exactly the same, the difference is only visual in the 3D view. When in watch mode the Observer does not move but updates to face the target agent.

How did the view change? Was it what you expected? How is it similar or different from using the mouse controls?

The direction of the the orbit commands refer to the direction that the Observer moves. That is, imagine that the Observer is on the surface of a sphere, the center of the sphere is the point that the Observer is facing represented by the blue cross, by default (0,0,0). The Observer will always face the center of the sphere and the radius of the sphere will remain constant. The directions, up, down, left, and right, refer to moving along the lines of latitude and the lines of longitude of the sphere. When you zoom the radius of the sphere changes but the center and the Observer's orientation in relation to the center of the sphere will remain the same.

How does the view change? How do the Observer variables change?

How does the view change? How do the Observer variables change?

When you setxyz the center of the sphere remains the same (so the Observer automatically keeps that point in the center of the view.) However, the radius of the sphere may change as well as the Observer's orientation in relation to the center. When you facexyz or face, the center of the sphere changes but the Observer does not move. The radius of the sphere may change, as well as the orientation of the Observer.