Garry's Mod Wiki

PathFollower

Path object for a NextBot NPC and bots created by player.CreateNextbot. Returned by Path.

Methods

PathFollower:Chase( NextBot bot, Entity ent, function generator = nil )
If you created your path with type "Chase" this functions should be used in place of PathFollower:Update to cause the bot to chase the specified entity.
boolean PathFollower:Compute( NextBot bot, Vector goal, function generator = nil )
Compute shortest path from bot to 'goal' via A* algorithm.
PathFollower:Draw()
Draws the path. This is meant for debugging - and uses debugoverlay.
table PathFollower:FirstSegment()
Returns the first segment of the path.
number PathFollower:GetAge()
Returns the age since the path was built
table PathFollower:GetAllSegments()
Returns all of the segments of the given path.
Vector PathFollower:GetClosestPosition( Vector position )
The closest position along the path to a position
table PathFollower:GetCurrentGoal()
Returns the current goal data. Can return nil if the current goal is invalid, for example immediately after PathFollower:Update.
table PathFollower:GetCursorData()
Returns the cursor data
number PathFollower:GetCursorPosition()
Returns the current progress along the path
Vector PathFollower:GetEnd()
Returns the path end position
number PathFollower:GetGoalTolerance()
Returns how close we can get to the goal to call it done.
Entity PathFollower:GetHindrance()
number PathFollower:GetLength()
Returns the total length of the path
Returns the minimum range movement goal must be along path.
Vector PathFollower:GetPositionOnPath( number distance )
Returns the vector position of distance along path
Vector PathFollower:GetStart()
Returns the path start position
PathFollower:Invalidate()
Invalidates the current path
boolean PathFollower:IsValid()
Returns true if the path is valid
table PathFollower:LastSegment()
Returns the last segment of the path.
PathFollower:MoveCursor( number distance )
Moves the cursor by give distance. For a function that sets the distance, see PathFollower:MoveCursorTo.
PathFollower:MoveCursorTo( number distance )
Sets the cursor position to given distance. For relative distance, see PathFollower:MoveCursor.
PathFollower:MoveCursorToClosestPosition( Vector pos, number type = 0, number alongLimit = 0 )
Moves the cursor of the path to the closest position compared to given vector.
PathFollower:MoveCursorToEnd()
Moves the cursor to the end of the path
PathFollower:MoveCursorToStart()
Moves the cursor to the end of the path
table PathFollower:NextSegment()
Returns the next segment of the path.
table PathFollower:PriorSegment()
Returns the previous segment of the path.
PathFollower:ResetAge()
Resets the age which is retrieved by PathFollower:GetAge to 0.
PathFollower:SetGoalTolerance( number distance )
How close we can get to the goal to call it done
PathFollower:SetMinLookAheadDistance( number mindist )
Sets minimum range movement goal must be along path
PathFollower:Update( NextBot bot )
Move the bot along the path.