A* Pathfinding Project
3.1.4
The A* Pathfinding Project for Unity 3D
|
Local Avoidance (beta). More...
Classes | |
class | HalfPlane |
struct | IntersectionPair |
class | VO |
struct | VOIntersection |
struct | VOLine |
Public Types | |
enum | IntersectionState { Inside, Outside, Enter, Exit } |
enum | ResolutionType { Sampled, Geometric } |
Public Member Functions | |
bool | CheckSample (Vector3 sample, List< VO > vos) |
Vector3 | ClampMovement (Vector3 direction) |
Vector3 | GetVelocity () |
void | LateUpdate () |
void | SimpleMove (Vector3 desiredMovement) |
Simple move. | |
Public Attributes | |
float | circlePoint = 0.5F |
float | circleScale = 0.5F |
float | delta = 1.0F |
How many seconds to plan for. | |
bool | drawGizmos = false |
float | maxSpeedScale = 1.5F |
Based on the desired velocity, how much larger magnitude should the output be allowed to have. | |
const float | Rad2Deg = (float)(360.0/(Math.PI*2)) |
float | radius = 0.5F |
float | responability = 0.5F |
Blending between taking this vecocity or other units velocity into account. | |
ResolutionType | resType = ResolutionType.Geometric |
Type of solver for local avoidance. | |
Vector3[] | samples |
float | sampleScale = 1F |
Protected Attributes | |
LocalAvoidance[] | agents |
CharacterController | controller |
Private Member Functions | |
void | Start () |
Initialization. | |
Private Attributes | |
const int | maxVOCounter = 50 |
Vector3 | preVelocity |
Vector3 | velocity |
Velocity during last frame. | |
List< VO > | vos = new List<VO> () |
Local Avoidance (beta).
This component can be used as a CharacterController with the call SimpleMove.
Using this on multiple units will improve how they behave in groups and avoid collisions.
Known limitations and issues
See demo of the script here: http://www.youtube.com/watch?v=WUOymX-NpN4
Keep in mind that this is a beta, some features might not work properly and the script is really messy.
Based on ClearPath, RVO, VO and a number of other techniques. This is roughly the same technique which Unity's local avoidance uses.
void SimpleMove | ( | Vector3 | desiredMovement | ) |
Simple move.
Similar to CharacterController.SimpleMove, but this will try to avoid other units
|
private |
Initialization.
Caches CharacterController component and finds other agents
float delta = 1.0F |
How many seconds to plan for.
1.0 usually works best
float responability = 0.5F |
Blending between taking this vecocity or other units velocity into account.
0.5 usually works best
ResolutionType resType = ResolutionType.Geometric |
Type of solver for local avoidance.
The Geometric one is the one most developed and works best usually.
The sampled one also works quite good, but not in all cases