A* Pathfinding Project  4.1.7
The A* Pathfinding Project for Unity 3D
StartEndModifier Class Reference

Adjusts start and end points of a path. More...

Detailed Description

Adjusts start and end points of a path.

This modifier is included in the Seeker component and is always used if you are using a Seeker. When a path is calculated the resulting path will only be the positions of the nodes it passes through. However often you may not want to navigate to the center of a specific node but instead to a point on the surface of a node. This modifier will adjust the endpoints of the path.

Public Types

enum  Exactness {
  SnapToNode, Original, Interpolate, ClosestOnNode,
  NodeConnection
}
 Sets where the start and end points of a path should be placed. More...
 

Public Member Functions

override void Apply (Path _p)
 Main Post-Processing function. More...
 
Vector3 GetClampedPoint (Vector3 from, Vector3 to, GraphNode hint)
 
- Public Member Functions inherited from PathModifier
void Awake (Seeker seeker)
 
void OnDestroy (Seeker seeker)
 
virtual void PreProcess (Path path)
 

Public Attributes

bool addPoints
 Add points to the path instead of replacing them. More...
 
System.Func< Vector3 > adjustStartPoint
 Will be called when a path is processed. More...
 
Exactness exactEndPoint = Exactness.ClosestOnNode
 
Exactness exactStartPoint = Exactness.ClosestOnNode
 
LayerMask mask = -1
 
bool useGraphRaycasting
 
bool useRaycasting
 
- Public Attributes inherited from PathModifier
Seeker seeker
 

Properties

override int Order [get]
 
- Properties inherited from PathModifier
abstract int Order [get]
 Modifiers will be executed from lower order to higher order. More...
 
- Properties inherited from IPathModifier
int Order [get]
 

Private Member Functions

Vector3 Snap (ABPath path, Exactness mode, bool start, out bool forceAddPoint)
 

Private Attributes

List< GraphNodeconnectionBuffer
 
System.Action< GraphNodeconnectionBufferAddDelegate
 

Member Enumeration Documentation

◆ Exactness

enum Exactness
strong

Sets where the start and end points of a path should be placed.

Enumerator
SnapToNode 

The point is snapped to the first/last node in the path.

Original 

The point is set to the exact point which was passed when creating the path request.

Interpolate 

The point is set to the closest point on the line between either the two first points or the two last points.

Usually you will want to use the NodeConnection mode instead since that is usually the behaviour that you really want.

ClosestOnNode 

The point is set to the closest point on the node.

Note that for some node types (point nodes) the "closest point" is the node's position which makes this identical to Exactness.SnapToNode

NodeConnection 

The point is set to the closest point on one of the connections from the start/end node.

Member Function Documentation

◆ Apply()

override void Apply ( Path  path)
virtual

Main Post-Processing function.

Implements PathModifier.

◆ GetClampedPoint()

Vector3 GetClampedPoint ( Vector3  from,
Vector3  to,
GraphNode  hint 
)

◆ Snap()

Vector3 Snap ( ABPath  path,
Exactness  mode,
bool  start,
out bool  forceAddPoint 
)
private

Member Data Documentation

◆ addPoints

bool addPoints

Add points to the path instead of replacing them.

◆ adjustStartPoint

System.Func<Vector3> adjustStartPoint

Will be called when a path is processed.

The value which is returned will be used as the start point of the path and potentially clamped depending on the value of the exactStartPoint field. Only used for the Original, Interpolate and NodeConnection modes.

◆ connectionBuffer

List<GraphNode> connectionBuffer
private

◆ connectionBufferAddDelegate

System.Action<GraphNode> connectionBufferAddDelegate
private

◆ exactEndPoint

◆ exactStartPoint

◆ mask

LayerMask mask = -1

◆ useGraphRaycasting

bool useGraphRaycasting

◆ useRaycasting

bool useRaycasting

Property Documentation

◆ Order

override int Order
get

The documentation for this class was generated from the following file: