A* Pathfinding Project  3.6.6
The A* Pathfinding Project for Unity 3D
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Properties Events Macros Groups Pages
RaycastModifier Class Reference

Simplifies a path using raycasting. More...

Detailed Description

Simplifies a path using raycasting.

This modifier will try to remove as many nodes as possible from the path using raycasting (linecasting) to validate the node removal. Either graph raycasts or Physics.Raycast

Public Member Functions

override void Apply (Path p, ModifierData source)
 Main Post-Processing function.
 
bool ValidateLine (GraphNode n1, GraphNode n2, Vector3 v1, Vector3 v2)
 
- Public Member Functions inherited from MonoModifier
virtual Vector3[] Apply (GraphNode[] path, Vector3 start, Vector3 end, int startIndex, int endIndex, NavGraph graph)
 
virtual Vector3[] Apply (Vector3[] path, Vector3 start, Vector3 end)
 
virtual void ApplyOriginal (Path p)
 
void Awake ()
 Alerts the Seeker that this modifier exists.
 
void OnDestroy ()
 
void OnDisable ()
 
void OnEnable ()
 
virtual void PreProcess (Path p)
 
- Public Member Functions inherited from IPathModifier
void Apply (Path p, ModifierData source)
 
void ApplyOriginal (Path p)
 
void PreProcess (Path p)
 

Public Attributes

int iterations = 2
 
LayerMask mask = -1
 
Vector3 raycastOffset = Vector3.zero
 
bool subdivideEveryIter = false
 
bool thickRaycast = false
 
float thickRaycastRadius = 0
 
bool useGraphRaycasting = false
 Use raycasting on the graphs.
 
bool useRaycasting = true
 
- Public Attributes inherited from MonoModifier
int priority = 0
 Higher priority modifiers are executed first.
 
Seeker seeker
 

Properties

override ModifierData input [get]
 
override ModifierData output [get]
 
- Properties inherited from MonoModifier
abstract ModifierData input [get]
 
abstract ModifierData output [get]
 
int Priority [get, set]
 
- Properties inherited from IPathModifier
ModifierData input [get]
 
ModifierData output [get]
 
int Priority [get, set]
 

Static Private Attributes

static List< Vector3 > nodes
 To avoid too many memory allocations.
 

Member Function Documentation

override void Apply ( Path  p,
ModifierData  source 
)
virtual

Main Post-Processing function.

Implements MonoModifier.

bool ValidateLine ( GraphNode  n1,
GraphNode  n2,
Vector3  v1,
Vector3  v2 
)

Member Data Documentation

int iterations = 2
LayerMask mask = -1
List<Vector3> nodes
staticprivate

To avoid too many memory allocations.

An array is kept between the checks and filled in with the positions instead of allocating a new one every time.

Vector3 raycastOffset = Vector3.zero
bool subdivideEveryIter = false
bool thickRaycast = false
float thickRaycastRadius = 0
bool useGraphRaycasting = false

Use raycasting on the graphs.

Only currently works with GridGraph and NavmeshGraph and RecastGraph.

A* Pro Feature:
This is an A* Pathfinding Project Pro feature only. This function/class/variable might not exist in the Free version of the A* Pathfinding Project or the functionality might be limited
The Pro version can be bought here
bool useRaycasting = true

Property Documentation

override ModifierData input
get
override ModifierData output
get

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