Move
Icon
Function
The Move component allows an Agent to move within a Cell space.
Movement Modes
- Turn: The Agent changes its direction.
- Forward/Backward: The Agent moves forward or backward based on its current direction (
Angle
built-in property). - Translate: The Agent moves to a specified position without changing its direction.
"Move" refers to the physical properties of motion. For a detailed explanation of how it differs from the Place At component, please refer to the Place At chapter.
How to Set Up
First, specify the Action, then set the parameters for that action.
Specify the Action
Select the Action from the dropdown menu. Descriptions of each mode are provided below.
Settings for Each Movement Mode
When discussing different types of movements, always describe them from the perspective of the Agent executing the process.
Turn Left
-
Function
Turn counterclockwise at a specified angle. If the Angle holds a negative value, the Agent will turn clockwise by the absolute value.
-
Setting
Specify Angle: The input field accepts any expression that returns a Number.
Turn Right
Similar to "Turn Left," but turns in the opposite direction.
Face Entity
-
Function
Rotate to face a specific Agent entity or a Cell entity within the same space as the Agent.
-
Setting
Specify Entity: The input field accepts any expression that returns an Agent or Cell Entity.
Face Coord.
-
Function
Rotate to face a specific coordinate.
-
Setting
Specify Coordinates: The input field accepts any expression that returns a coordinate in the format
[Number, Number]
. -
Note:
- If the Cell space wraps around, you can specify any coordinates.
- If it doesn't, you need to specify coordinates within the current Cell space's scope.
Face Angle
-
Function
Rotate to face a specified absolute direction angle (East 0°, North 90°).
-
Setting
Specify Angle: The input field accepts any expression that returns a number.
Forward
-
Function
- Moves the Agent continuously in the current direction with a specified step until it reaches the target distance or maximum possible range. A negative distance indicates backward movement.
- When the Agent reaches the boundary, it will continue moving if the space wraps; otherwise, it will stop at the last feasible position.
-
Setting
- Specify Distance: Enter any expression that returns a Number in the input field.
- Specify Step: Enter any expression that returns a positive Number in the input field. By default, this equals the absolute value of the distance.
In a 2D space without horizontal wrapping, an Agent starts from the origin at the center, moving horizontally to the right with a distance of 1 and a step of 0.2. If the maximum x coordinate of the Cell is 5, the Agent will eventually stop at (5.4, 0)
, the last reachable position.
- The step should generally be less than or equal to the absolute value of the distance. If the step exceeds the distance, it behaves as if it equals the distance.
- The relationships between step and distance apply similarly to backward movement and coordinate translation.
Backward
- Similar to "Forward", but moves in the opposite direction.
Move to Coord.
-
Function
Move to a specified coordinate while maintaining the current direction.
-
Settings
- Specify Coordinates: The input field accepts any expression that returns a coordinate in the format
[Number, Number]
. - Specify Distance: The input field accepts any expression that returns a number.
- Specify Step: Enter any expression that returns a positive Number in the input field. By default, this equals the absolute value of the distance.
- Specify Coordinates: The input field accepts any expression that returns a coordinate in the format
The Move Component Has Data Output
-
Angle
- Reflects the total change in the Agent's direction after movement, with a positive value indicating a counterclockwise direction.
- This data is returned in a Number format.
- You can access the Angle using
This.Angle
in computations after this component's action. - The Angle can be accessed in the formula of subsequent objects as "
move_component_name.Angle
".
-
Distance
- Represents the actual distance traveled by the Agent after movement.
- This data is also returned in a Number format.
- You can access the Distance using
This.Distance
in computations after this component's action. - The Distance can be accessed in the formula of subsequent objects as "
move_component_name.Distance
".
- The output provided by the system for the Move component represents the total change.
- For an Agent facing the 0° direction and starting from
[0,5]
in a Cell world with a width of11
, after crossing the left boundary once and stopping at[0,6]
, the output distance will be 12, not 1. - The output for the angle change follows the same rule.
- From this, it's clear that the Place At component instantly alters the Agent's spatial position without causing motion. On the other hand, the Move component involves continuous physical movement that takes time, thus producing motion output.
Example
A wolf continuously moves around the grassland.