Flow Fields Sample
This sample demonstrates how to use the quantum flow fields addon.
|2.1.5||May 11, 2023||Flow Fields Sample 2.1.5 Build 195|
The simple example showcases only one moving unit in a static predefined map.
Where To Look?
- The example is implemented in the 'ExampleBasic' scene;
- Right Mouse Button - sets unit's new destination
FlowFieldMapis created when simulation starts from static data (ExampleBasicSystem.cs)
The advanced example showcases multiple units with avoidance and final destination grouping.
Where To Look?
- The example is implemented 'ExampleAdvanced' scene;
- Left Mouse Button - click/drag to select single/multiple units;
- Right Mouse Button - set a new destination for selected unit;
- WASD/arrows - camera movement;
- scroll wheel - camera zoom;
- Q - spawn a new unit on the cursor position;
- E - change the cost of the tile on cursor position (between 1 a 255)
- The Map parameters are defined in
- The Map cost field is baked via
TileMapBaker- based on Static Box and Circle colliders placed in scene;
FlowFieldMapis created when the simulation starts (TileMapSystem.cs)
Units are moved by setting their velocity based on data provided by
Avoidance between units is done with physics. The
Physics Solver Iterations are set to 0. To tweak the behaviour you can play with
Penetration Allowance and
Penetration Correction in
- Penetration Allowance - Allow a certain degree of penetration to improve the stability of the physics simulation.
- Penetration Correction - How much of the exceeding penetration (above allowance) should be corrected in a single frame. 0 = no correction, 1 = full correction.
When multiple units are controlled at the same time they are put into a UnitGroup. Units still move on their own (they can choose different paths towards the destination) but their final destination is stored in the formation.
Based on Quantum version 2.1.5 Stable 1144