Orient Toward Value
This behavior causes an agent to update its direction vector based on the orienttowardvalue property of its neighbors. If orienttowardvalue_uphill is true then the agent will orient towards the position of the neighbor with the maximum value, and vice versa. The default state for that is true.
Published by
Shortname
@hash/orient_toward_value.rs
Description

This behavior causes an agent to update its direction vector based on the orient_toward_value property of its neighbors. If orient_toward_value_uphill is true then the agent will orient towards the position of the neighbor with the maximum value, and vice versa. The default state for that is true.

If orient_toward_value_cumulative is true, then the behavior will orient towards the location with the max/min value by summing the values of neighbors who share the same position.

Example

This agent will climb "uphill". Each time step it first faces its tallest neighbor, and then moves towards it:

const mountainClimber = {
    behaviors: ["orient_toward_value", "move_in_direction"],
    orient_toward_value_uphill: true,
    orient_toward_value: ["height"]
}