PathBerserker2d
1.0
Platformer pathfinding solution
|
PathBerserker comes with 2 components, which implement NavAgent movement. These are: "TransformBasedMovement" and "CorgiBasedMovement". A NavAgent without either one of these components attached will still be able to pathfind, but won't move along the path.
To use "CorgiBasedMovement", you must own CorgiEngine (https://corgi-engine.moremountains.com/) and have it imported. More about PathBerserkers Corgi integration here: Corgi
TransformBasedMovement is Pathberserker's own movement solution. It works by directly manipulating the transform of a NavAgent and allows for very precise movement. It's main drawback is, that there is no physics interaction between a NavAgent and its environment. There is nothing stopping a NavAgent from moving through a collider.
TransformBasedMovement implements movement for segments and links. Segments, which represent movement on the ground are traversed by simple lerping between start and goal.
Links are traversed depending on their type. Following are the build-in link types.
You are free to implement your own movement handler, if the build-in's don't fit your usecase. For inspiration, please look at the source code for TransformBasedMovement and CorgiBasedMovement.
The NavAgent has an internal pointer, that keeps track of where the NavAgent is on its calculated path. A movement handler must implement moving the NavAgent to its current PathSubGoal and then call either CompleteSegmentTraversal or CompleteLinkTraversal to advance the NavAgents internal path pointer to the next subgoal.
A custom movement handler can make use of the following NavAgent events.