⚒️Formation Manager
Steps to add setup the scene for the movement manager
Overview
Moving Formation package in its core provides a system which calculates desired positions of each unit while moving in any formation and their speed. It does not use navigation directly, so it is flexible to be used with any navigation system you might be using (like Native Unity NavMesh, A* Pathfinding Project, etc).
Because manager does not really move units, you still need something to control their movement and speed. For this additional package is present called Unit Formation. It is used for built-in control and unit management. Both Moving Formations and Unit Formation packages provide integration with:
Native Unity NavMesh ✅ (Full)
A* Pathfinding Project ⚠️ (Partial)
Unit Formation has full support, Moving Formations does not. However you can implement the interface on your own to give it full support.
Add Manager
To set up the system for moving the units in formation add FormationMovementManager component to any object in the scene. This is the main component used for starting, updating and ending formation movement.
Then attach configuration asset to it, you can use and update provided one, or create new asset. (see below)
Check out each tab and hover over properties to find out what it is used for. You can fine tune the movement based on your unit setup to make sure formation moves smoothly.

You can also create multiple configurations and swap them during runtime!

Example of how to update configuration at runtime. You can also use configuration asset to update current configuration.
var data = new SystemConfigurationData
{
laggingUnitMaxSpeedIncrease = 2,
minFormationSpeed = 2,
groupJoinThreshold = 10,
enableGroupLagging = true,
laggingGroupDecreaseSpeed = 1,
};
// If no manager exists, new instance will be created when `Current` is called.
// There can be more managers present in the scene if needed, but last one loaded
// will be used as `Current`.
FormationMovementManager.Current.SetConfiguration(newConfig);Add Pathfinding
Additionally the system utilises navigation system to find viable formation path on the nav mesh.
If you are using Unity's built in navigation system add
NavMeshNavigationPathfindercomponent in scene, preferably on the same object as the system.Or implement your own class with
INavigationPathfinderinterface. You can checkNavMeshNavigationPathfinderorASPNavigationPathfinderto see how this can be done with just a few lines of code.
Ok, You are now done with scene set up!
Under the hood
All the handling for moving the formations can most conveniently be use through FormationMovementManager component. Under the hood it uses FormationMovementSystem which is not a Mono and requires a bit more manual work to use it. Here you will learn about the Manager and how to use it.
FormationMovementSystem is where computation for formations takes place and is packed in a neat .dll with a documentation pages available in the package. For best performance, you can use the system directly. See manager component as an example.
Last updated