Creating a group of followers
In this example, we're going to build another AI type called a follower agent. This time, a group of followers will stay together and move toward their leader. The leader, on the other hand, is still the same seeking agent that will randomly move around the sandbox, completely oblivious to the group of followers behind it.

Group-based movement using separation, cohesion, and alignment
To create followers, we'll use multiple steering forces to combine, separate, and align our agents to the leader agent they are following.
Create the Lua file as follows:
src/my_sandbox/script/FollowerAgent.lua
FollowerAgent.lua
:
require "AgentUtilities"; local leader; function Agent_Initialize(agent) AgentUtilities_CreateAgentRepresentation( agent, agent:GetHeight(), agent:GetRadius()); -- Randomly assign a position to the agent. agent:SetPosition(Vector.new( math.random(-50, 50), 0, math.random(-50, 50))); -- Assign the first valid agent as the...