Class GridStringPulling
Public
Simplifies a path on a grid graph using a string pulling algorithm.
This is based on a paper called "Toward a StringPulling Approach to Path Smoothing on Grid Graphs", with some optimizations as well as fixes for some edge cases that the paper didn't handle.
The result is conceptually similar to the well known funnel string pulling algorithm for navmesh graphs but it uses a different algorithm.
This class is used by the FunnelModifier on grid graphs.
Inner Types
Public Static Methods
List<Vector3>
Calculate
(
List<GraphNode>  pathNodes  A list of input nodes. Only the slice of nodes from nodeStartIndex to nodeEndIndex (inclusive) will be used. These must all be of type GridNodeBase and must form a path (i.e. each node must be a neighbor to the next one in the list). 
int  nodeStartIndex  The index in pathNodes to start from. 
int  nodeEndIndex  The last index in pathNodes that is used. 
Vector3  startPoint  A more exact start point for the path. This should be a point inside the first node (if not, it will be clamped to the node's surface). 
Vector3  endPoint  A more exact end point for the path. This should be a point inside the first node (if not, it will be clamped to the node's surface). 
System.Func<GraphNode, uint>  traversalCost=null  Can be used to specify how much it costs to traverse each node. If this is null, node penalties and tag penalties will be completely ignored. 
System.Func<GraphNode, bool>  filter=null  Can be used to filter out additional nodes that should be treated as unwalkable. It is assumed that all nodes in pathNodes pass this filter. 
int  maxCorners=int.MaxValue  If you only need the first N points of the result, you can specify that here, to avoid unnecessary work. 
)
Simplifies a path on a grid graph using a string pulling algorithm.
See the class documentation for more details.
float
IntersectionLength
(
int2  nodeCenter  
int2  segmentStart  
int2  segmentEnd  
)
Intersection length of the given segment with a square of size Int3.Precision centered at nodeCenter.
The return value is between 0 and sqrt(2).
Private/Protected Members
const int
FixedPrecisionScale = 1024
uint
LinecastCost
(
)
Cost of moving across all the nodes in the list, along the given segment.
It is assumed that the segment intersects the nodes. Any potentially intersecting nodes that are not part of the list will be ignored.
PredicateFailMode
Undefined 

Turn 

LinecastObstacle 

LinecastCost 

ReachedEnd 

Side
Side2D
(
)
Returns which side of the line a  b that p lies on.
void
TestIntersectionLength
()
int2
ToFixedPrecision
(
)
Z  .
3 2 \  / –  X  —– X /  \ 0 1
 
Unity.Profiling.ProfilerMarker
marker1 = new Unity.Profiling.ProfilerMarker("Linecast hit")
Unity.Profiling.ProfilerMarker
marker2 = new Unity.Profiling.ProfilerMarker("Linecast success")
Unity.Profiling.ProfilerMarker
marker3 = new Unity.Profiling.ProfilerMarker("Trace")
Unity.Profiling.ProfilerMarker
marker4 = new Unity.Profiling.ProfilerMarker("Neighbours")
Unity.Profiling.ProfilerMarker
marker5 = new Unity.Profiling.ProfilerMarker("Reevaluate linecast")
Unity.Profiling.ProfilerMarker
marker6 = new Unity.Profiling.ProfilerMarker("Init")
Unity.Profiling.ProfilerMarker
marker7 = new Unity.Profiling.ProfilerMarker("Initloop")