The Seeker Component

The Seeker component is the script which will call the A* script when a path needs to be calculated and receive the calculated path, it will then post process the path and then send it to all scripts in the same gameObject.

Seeker

Functions

Receives

StartPath

[Vector3 start, Vector3 end] Starts a path search.

OnComplete

[Path p] The A* script sends this when the pathfinding is finished.

Sends

PathComplete

[Vector3[] points] This will be sent as a SendMessage when the path has been calculated, it contains all the waypoints the player/NPC/unit/whatever needs to follow.

PathError

[...] This will be sent as a SendMessage when the pathfinding returned an error and On Error (variable) is set to Error Message.

StartPathYield

[Path p, Seeker s] This is sent to the A* script when it should start the pathfinding.

Variables

Debug Path

[bool] Should the script show the calculated path in the scene view?

Max Angle

[float] The max slope angle this seeker should be able to travel.

Angle Cost

[float] The cost of moving in a slope.

Remove First

[bool] If true, the script removes the first waypoint in the path, can help reducing jittering.

Step By Step

[bool] Mostly for debugging, if true the script only searches one node per frame.

Start Point

[enum] This variable defines if the first point in the path should be snapped to the nearest node or not.

End Point

[enum] Same as Start Point but for the last point in the path, but has also an extra option ‘Add Exact’, if chosen the script will add the exact end point to the path instead of replacing the last point

On Error

[enum] What should the script do when there is no valid path to the target?
None: Does nothing when encountering an error.
Error Message: Sends an error message, PathError ()
Empty Array: Sends a PathComplete message but with an empty array.
If a new pathfinding search has been initialised before the previous one ended, no message will be sent.

Grid Selection

[enum] This can be used to tell the script to only search a specific grid.
Auto: Searches all grids and uses the best one.
Fixed: Uses the grid which was set in the ‘Grid’ variable.

Grid

[int] If Grid Selection is set to Fixed, this indicates the grid to search, 0 means the first grid in the grids array, and 2 means the third grid in the array.

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>