Moving Agents Around the 3D World
<< previous | Chapter 5. Basic Agent Behaviors: Motion, Appearance and Communication | next >>

## Moving Agents Around the 3D World

Agents can be moved around the world in a number of ways: by specifying their locations, their velocities and their accelerations. Object locations are typically set during initialization, while velocity and acceleration are typically adjusted dynamically over the course of the simulation.

Agents can be explicitly moved to a specific location using the method move in the class Mobile:

    # move the agent to the location (10, 0, 0) in 3D space...

    self move to (10, 0, 0).

The speed of an agent can be set using the method set-velocity in the class Mobile:

    # set the agent's velocity to (0, 0, 10)

    self set-velocity to (0, 0, 10).

The acceleration of an agent can be set using the method set-acceleration in the class Mobile:

    # set the agent's acceleration to (0, -9.8, 0)

    self set-acceleration to (0, -9.8, 0).

<< previous | Up | next >>
Changing the Appearance of Agents | Table of Contents | Scheduling Events for a Specific Time