The navigation mesh library. To be used with CNavArea.
The navigation mesh is used by NextBot to calculate path to its target.
navmesh.AddWalkableSeed( Vector pos, Vector dir )
Add this position and normal to the list of walkable positions, used before map generation with navmesh.BeginGeneration
Starts the generation of a new navmesh. This process is highly resource intensive and it's not wise to use during normal gameplay
Clears all the walkable positions, used before calling navmesh.BeginGeneration.
table navmesh.Find( Vector pos, number radius, number stepdown, number stepup )
Returns a bunch of areas within distance, used to find hiding spots by NextBots for example.
Returns an integer indexed table of all CNavAreas on the current map. If the map doesn't have a navmesh generated then this will return an empty table.
Returns the position of the edit cursor when nav_edit is set to 1.
number, Vector navmesh.GetGroundHeight( Vector pos )
Finds the closest standable ground at, above, or below the provided position. The ground must have at least 32 units of empty space above it to be considered by this function, unless 16 layers are tested without finding valid ground.
Returns the currently marked CNavArea, for use with editing console commands.
Returns the currently marked CNavLadder, for use with editing console commands.
CNavArea navmesh.GetNavArea( Vector pos, number beneathLimit )
Returns the Nav Area contained in this position that also satisfies the elevation limit. This function will properly see blocked CNavAreas. See navmesh.GetNearestNavArea.
CNavArea navmesh.GetNavAreaByID( number id )
Returns a CNavArea by the given ID. Avoid calling this function every frame, as internally it does a lookup trough all the CNavAreas, call this once and store the result
Returns the highest ID of all nav areas on the map. While this can be used to get all nav areas, this number may not actually be the actual number of nav areas on the map.
CNavArea navmesh.GetNearestNavArea( Vector pos, boolean anyZ = false, number maxDist = 10000, boolean checkLOS = false, boolean checkGround = true, number team = TEAM_ANY=-2 )
Returns the closest CNavArea to given position at the same height, or beneath it. This function will ignore blocked CNavAreas. See navmesh.GetNavArea for a function that does see blocked areas.
Whether we're currently generating a new navmesh with navmesh.BeginGeneration.
Loads a new navmesh from the .nav file for current map discarding any changes made to the navmesh previously.
Deletes every CNavArea and CNavLadder on the map without saving the changes.
Saves any changes made to navmesh to the .nav file.
navmesh.SetMarkedArea( CNavArea area )
Sets the CNavArea as marked, so it can be used with editing console commands.
navmesh.SetMarkedLadder( CNavLadder area )
Sets the CNavLadder as marked, so it can be used with editing console commands.