Class CorridorProcessor
Provides functions for processing a corridor to straighten a path through a corridor. A corridor is defined as a segment that has a Left and Right point to which the agent must travel in order to stay on the path.
Inheritance
Namespace: AnyPath.Graphs
Assembly: Assembly-CSharp.dll
Syntax
public static class CorridorProcessor
Methods
| Improve this Doc View SourceProcess<TProj, T>(NativeSlice<TProj>, NativeSlice<T>)
Modifies the path in place in order to create a straight line through the corridor.
Declaration
public static int Process<TProj, T>(NativeSlice<TProj> projectedSegments, NativeSlice<T> path)
where TProj : struct, ICorridorSegmentProjection where T : struct, ICorridorSegment
Parameters
Type | Name | Description |
---|---|---|
Unity.Collections.NativeSlice<TProj> | projectedSegments | The projected segments in 2D space. |
Unity.Collections.NativeSlice<T> | path | The path segments in 3D space. The segment's TargetPosition is modified in place to reflect the ideal target position that forms a straight path between multiple segments. |
Returns
Type | Description |
---|---|
System.Int32 | The index in the path array that contains the first corner. If you use this algorithm in realtime, this can be the target to steer towards. |
Type Parameters
Name | Description |
---|---|
TProj | |
T |
Remarks
In order to create an exact starting and goal position within the segment, set both the Left and Right properties of the first and last projected segment to the desired position.
Realtime<TProj, T>(NativeSlice<TProj>, NativeSlice<T>, float2, Int32)
Declaration
public static int Realtime<TProj, T>(NativeSlice<TProj> projectedSegments, NativeSlice<T> path, float2 startPos, int startIndex)
where TProj : struct, ICorridorSegmentProjection where T : struct, ICorridorSegment
Parameters
Type | Name | Description |
---|---|---|
Unity.Collections.NativeSlice<TProj> | projectedSegments | |
Unity.Collections.NativeSlice<T> | path | |
Unity.Mathematics.float2 | startPos | |
System.Int32 | startIndex |
Returns
Type | Description |
---|---|
System.Int32 |
Type Parameters
Name | Description |
---|---|
TProj | |
T |