![]() |
PathBerserker2d
1.0
Platformer pathfinding solution
|
A collection of line segments to traverse on. More...
Public Member Functions | |
Vector2 | LocalToWorld (Vector2 pos) |
Matrix4x4 | LocalToWorldMatrix () |
Vector2 | WorldToLocal (Vector2 pos) |
Matrix4x4 | WorldToLocalMatrix () |
IEnumerator | Bake () |
Updates NavSurface baked data. Baking largely runs in a different thread. This function should be run as a Coroutine. NavSurface will be removed from World first and added back, when baking is completed. Calling this function before the previous bake job completed, will abort the previous job. More... | |
Public Attributes | |
float | MaxClearance => maxClearance |
float | MinClearance => minClearance |
float | CellSize => cellSize |
LayerMask | ColliderMask => includedColliders |
float | TotalLineLength => totalLineLength |
Length of all segments combined More... | |
float | MaxSlopeAngle => maxSlopeAngle |
Segments exceeding this angle are removed from the bake output. Should equal the highest slope angle of your NavAgents. More... | |
float | SmallestDistanceYouCareAbout => smallestDistanceYouCareAbout |
Parameter for the line simplifier (Ramer-Douglas-Peucker). Higher values reduce overall segment count at the expense of fitting the original collider shape. More... | |
float | MinSegmentLength => minSegmentLength |
Segments shorter than this will be removed from the bake output. More... | |
Properties | |
Rect | WorldBounds [get] |
A collection of line segments to traverse on.
NavSurfaces are independent collections of segments. At runtime their data gets added to the pathfinder. You can load and unload NavSurfaces at runtime. This allows you to setup Prefabs with navigation data and stream them in at runtime. Loading and unloading is as simple as enabling and disabling a NavSurface script.
The bake process only consideres colliders that are children of the NavSurface. This also extends to the clearance calculation of segment cells. Baking is currently limited to editor mode only. You can't bake at runtime.
All baked postion data is relative to the current NavSurface position. Only to the position though, not to it's rotation or scale. This allows NavSurfaces to be moved at runtime, without requiring a rebake. Segments in calculated paths remain relative to the NavSurface of origin. If you pathfind on a NavSurface and then move it, the path will reflect that transformation.
See also Core concepts: NavAgent.
IEnumerator PathBerserker2d.NavSurface.Bake | ( | ) |
Updates NavSurface baked data. Baking largely runs in a different thread. This function should be run as a Coroutine. NavSurface will be removed from World first and added back, when baking is completed. Calling this function before the previous bake job completed, will abort the previous job.
float PathBerserker2d.NavSurface.MaxSlopeAngle => maxSlopeAngle |
Segments exceeding this angle are removed from the bake output. Should equal the highest slope angle of your NavAgents.
float PathBerserker2d.NavSurface.MinSegmentLength => minSegmentLength |
Segments shorter than this will be removed from the bake output.
float PathBerserker2d.NavSurface.SmallestDistanceYouCareAbout => smallestDistanceYouCareAbout |
Parameter for the line simplifier (Ramer-Douglas-Peucker). Higher values reduce overall segment count at the expense of fitting the original collider shape.
float PathBerserker2d.NavSurface.TotalLineLength => totalLineLength |
Length of all segments combined