Unity-Local Avoidance U3856
Lightweight and high performing local avoidance solution that can be easily integrated.
Programmable Render Pipeline (SRP) compatibility
The Unity Programmable Render Pipeline (SRP) is a feature that allows you to control rendering through C# scripts. SRP is the underlying technology that supports the Universal Rendering Pipeline (URP) and the High Definition Rendering Pipeline (HDRP).
Unity version
Built-in rendering pipeline
Universal Rendering Pipeline (URP)
High Definition Rendering Pipeline (HDRP)
2019.4.35f1
compatible
compatible
compatible
describe
This package contains fast lightweight solution for local avoidance. It is developed with DOTS in mind, as result it takes advantage of Unity latest technology stack like SIMD mathematics, Jobs and Burst compiler.
Local avoidance allows agent to avoid dynamic obstacles, with accuracy, speed and not requiring pre processing. However keep in mind it does not replace global navigation (etc. A* Pathing solutions) which is designed to find most optimal path around static obstacles. Local avoidance it is intended to be used in complimentary with such a system in full scale game.
At its core it uses novel solution, which is heavily inspired by Starcraft 2 game.
Are there components that I can use?
No, the whole logic is separated into single structure and no components are used. Thus allowing easy integration in any existing Global Pathing system, regardless if it’s OOD or DOD.
For this reason this package is highly recommended for people who have experience coding as it is expected from user to integrate the solution into their own ecosystem. There are component ready demos, but they are solely there as examples.
For those, who want mono components or ecs based implementation you can check version 3.0 as Agents Navigation.
What is the API?
The whole avoidance solution is contained in a single structure called SonarAvoidance. The usage of structure is composed of mainly 4 steps: construct, add obstacles, find avoidance direction and cleanup.
var sonar = new SonarAvoidance(…)
sonar.InsertObstacle(…)
sonar.FindClosestDirection(out float3 direction)
sonar.Dispose()
Support Discord
Demo Zerg
Key Behaviors
Manages navigation out of concave obstacles
Circles target
Avoids head to head moving
Accurately respects radius
Predicts collisions and avoids based on that
Avoids only when necessary
Dependencies
Tested with Unity 2019.4
Package com.unity.mathematics
Package com.unity.collections
Package com.unity.burst
Note: This does not include Global Avoidance which is typical archieved using A* algorithm on data structures like NavMesh or Grid and targeted for static obstacles. Local avoidance typically used as complimentary system for it to target dynamic obstacle avoidance.
technical details
related keywords
RTS
AI
Obstacle Avoidance
Path
agent
Steering
navigation