Home

Awesome

Unity-Formation-Movement

Formation movement for Unity3D using standard Navmesh or A*Pathfinding

New version available

Please note a new version of the Formation Movement is available: Formation Movement 2.0 I will archive this version soon (it will remain to be available read-only).

Summary

I've started gathering and configuring elements for Unity3D RTS style game which of course needs some pathfinding. Early on I found out that A Star Pathfinding by Aron Granberg (https://arongranberg.com/astar/front) is a good solution for pathfinding on Unity terrain. However it does not contain formation movement (also known as steering or flocking behavior) so I set out to create my own. So here we are.

Important to know:

Want to check what's possible with this code? Check out my channel on Youtube

Feedback received so far:

(Thanks Adam Goodrich for the feedback.)

Installation:

Copy the Scripts folder to your Unity Project.

Usage:

A FormationGrid contains a list of FormationGridPoints which have an offset position (in the x-z plane) from the FormationGrid position. Units (for example animated characters) can be assigned to the FormationGrid and will be automatically assigned to a FormationGridPoint. The FormationGrid will start following the FormationAnchor which contains the actual pathfinding components (AStarPathfinding or Navmesh).

Quick start:

The key scripts to look into first are: FormationSample.cs, FormationGrid.cs and FormationAnchor.cs.

Instruction video

A video instruction can be found here:https://youtu.be/vU-vG1gqkdQ?list=PLNMba_kYUs0f9h-_BXizxOk5h2_e7A3ql

Limitations:

License:

Unity-Formation-Movement is freely available under the MIT license. If you make any improvements, then please submit a pull request with them so everyone else can share in the knowledge.

References: