Flow Fields Sample
This sample demonstrates how to use the Quantum Flow Fields Addon.
Download
Version | Release Date | Download | |
---|---|---|---|
2.1.5 | Oct 23, 2023 | Flow Fields Sample 2.1.5 Build 285 |
Basic Example
The simple example showcases only one moving unit in a static predefined map.
Where to look?
- The example is implemented in the 'ExampleBasic' scene;
- \quantum_unity\Assets\Photon\FlowFields\ExampleBasic;
- \quantum_code\quantum.code\ExampleBasic
Controls
- Right Mouse Button - sets unit's new destination
Map Definition
FlowFieldMap
is created when simulation starts from static data (ExampleBasicSystem.cs)
Advanced Example
The advanced example showcases multiple units with avoidance and final destination grouping.
Where to look?
- The example is implemented 'ExampleAdvanced' scene;
- \quantum_unity\Assets\Photon\FlowFields\ExampleAdvanced;
- \quantum_code\quantum.code\ExampleAdvanced
Controls
- 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)
Map Definition
- The Map parameters are defined in
TileMapSetup
(\Assets\Photon\FlowFields\ExampleAdvanced\Resources\DB\ExampleAdvancedTileMapSetup); - The Map cost field is baked via
TileMapBaker
- based on Static Box and Circle colliders placed in scene; FlowFieldMap
is created when the simulation starts (TileMapSystem.cs)
Movement
Units are moved by setting their velocity based on data provided by FlowFieldPathfinder
.
Avoidance
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 Simulation Config
.
- 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.
UnitGroup
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.
Release Notes
Based on Quantum version 2.1.5 Stable 1144
Back to top