Discord
@hash/move-in-direction
Behavior
76
0
Public

Move In Direction

This behavior moves an agent according to its direction property. The agent will move in the x, y and z directions by the corresponding amounts* in the direction array.

This behavior moves an agent according to its direction property. The agent will move in the x, y and z directions by the corresponding amounts* in the direction array.

*Note this means that the direction array is not normalized.

Example

This agent will keep moving "south" until direction is modified:

const migratingAgent = {
    position: [6, 3],
    behaviors: ["move_in_direction"],
    direction: [0, -1]
}