|
A* Pathfinding Project
3.6.6
The A* Pathfinding Project for Unity 3D
|
Local Avoidance (beta) [obsolete]. More...
Local Avoidance (beta) [obsolete].
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.
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. | |
| void | Update () |
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 |
| float | speed = 2F |
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> () |
| enum IntersectionState |
| enum ResolutionType |
| bool CheckSample | ( | Vector3 | sample, |
| List< VO > | vos | ||
| ) |
| Vector3 ClampMovement | ( | Vector3 | direction | ) |
| Vector3 GetVelocity | ( | ) |
| void LateUpdate | ( | ) |
| 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
| void Update | ( | ) |
|
protected |
| float circlePoint = 0.5F |
| float circleScale = 0.5F |
|
protected |
| float delta = 1.0F |
How many seconds to plan for.
1.0 usually works best
| bool drawGizmos = false |
| float maxSpeedScale = 1.5F |
Based on the desired velocity, how much larger magnitude should the output be allowed to have.
|
private |
|
private |
| 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.
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
| Vector3 [] samples |
| float sampleScale = 1F |
| float speed = 2F |
|
private |
Velocity during last frame.