A* Pathfinding Project
4.3.2
The A* Pathfinding Project for Unity 3D
|
Modifier which smooths the path. More...
Modifier which smooths the path.
This modifier can smooth a path by either moving the points closer together (Simple) or using Bezier curves (Bezier).
Attach this component to the same GameObject as a Seeker component.
This component will hook in to the Seeker's path post-processing system and will post process any paths it searches for. Take a look at the Modifier Priorities settings on the Seeker component to determine where in the process this modifier should process the path.
Several smoothing types are available, here follows a list of them and a short description of what they do, and how they work. But the best way is really to experiment with them yourself.
Public Types | |
enum | SmoothType { Simple, Bezier, OffsetSimple, CurvedNonuniform } |
Public Member Functions | |
override void | Apply (Path p) |
Called for each path that the Seeker calculates after the calculation has finished. More... | |
List< Vector3 > | CurvedNonuniform (List< Vector3 > path) |
List< Vector3 > | SmoothBezier (List< Vector3 > path) |
List< Vector3 > | SmoothOffsetSimple (List< Vector3 > path) |
List< Vector3 > | SmoothSimple (List< Vector3 > path) |
![]() | |
virtual void | PreProcess (Path path) |
Static Public Member Functions | |
static Vector3 | GetPointOnCubic (Vector3 a, Vector3 b, Vector3 tan1, Vector3 tan2, float t) |
Public Attributes | |
float | bezierTangentLength = 0.4F |
Length factor of the bezier curves' tangents'. More... | |
float | factor = 0.1F |
Roundness factor used for CurvedNonuniform. More... | |
int | iterations = 2 |
Number of times to apply smoothing. More... | |
float | maxSegmentLength = 2F |
The length of the segments in the smoothed path when using uniformLength. More... | |
float | offset = 0.2F |
Offset to apply in each smoothing iteration when using Offset Simple. More... | |
SmoothType | smoothType = SmoothType.Simple |
Type of smoothing to use. More... | |
float | strength = 0.5F |
Determines how much smoothing to apply in each smooth iteration. More... | |
int | subdivisions = 2 |
Number of times to subdivide when not using a uniform length. More... | |
bool | uniformLength = true |
Toggle to divide all lines in equal length segments. More... | |
![]() | |
Seeker | seeker |
Properties | |
override int | Order [get] |
![]() | |
abstract int | Order [get] |
Modifiers will be executed from lower order to higher order. More... | |
![]() | |
int Util.IEntityIndex. | EntityIndex [get, set] |
Internal entity index used by #BurstBatchHelper. More... | |
![]() | |
int | EntityIndex [get, set] |
![]() | |
int | Order [get] |
Additional Inherited Members | |
![]() | |
virtual void | OnDisable () |
virtual void | OnEnable () |
Alerts the Seeker that this modifier exists. More... | |
![]() | |
virtual void | Awake () |
virtual int | OnUpgradeSerializedData (int version, bool unityThread) |
Handle serialization backwards compatibility. More... | |
virtual void | Reset () |
Handle serialization backwards compatibility. More... | |
|
strong |
|
virtual |
Called for each path that the Seeker calculates after the calculation has finished.
Implements MonoModifier.
List<Vector3> CurvedNonuniform | ( | List< Vector3 > | path | ) |
|
static |
List<Vector3> SmoothBezier | ( | List< Vector3 > | path | ) |
List<Vector3> SmoothOffsetSimple | ( | List< Vector3 > | path | ) |
List<Vector3> SmoothSimple | ( | List< Vector3 > | path | ) |
float bezierTangentLength = 0.4F |
Length factor of the bezier curves' tangents'.
float factor = 0.1F |
Roundness factor used for CurvedNonuniform.
int iterations = 2 |
Number of times to apply smoothing.
float maxSegmentLength = 2F |
The length of the segments in the smoothed path when using uniformLength.
A high value yields rough paths and low value yields very smooth paths, but is slower
float offset = 0.2F |
Offset to apply in each smoothing iteration when using Offset Simple.
SmoothType smoothType = SmoothType.Simple |
Type of smoothing to use.
float strength = 0.5F |
Determines how much smoothing to apply in each smooth iteration.
0.5 usually produces the nicest looking curves.
int subdivisions = 2 |
Number of times to subdivide when not using a uniform length.
bool uniformLength = true |
Toggle to divide all lines in equal length segments.
|
get |