Garry's Mod Wiki

CNavArea

An object returned by navmesh functions.

Methods

CNavArea:AddAttributes( number attribs )
Adds given attributes to given CNavArea. See CNavArea:HasAttributes and CNavArea:SetAttributes.
CNavArea:AddHidingSpot( Vector pos, number flags = 7 )
Adds a hiding spot onto this nav area. There's a limit of 255 hiding spots per area.
CNavArea:AddToClosedList()
Adds this CNavArea to the closed list, a list of areas that have been checked by A* pathfinding algorithm. Used in pathfinding via the A* algorithm. More information can be found on the Simple Pathfinding page.
CNavArea:AddToOpenList()
Adds this CNavArea to the Open List. Used in pathfinding via the A* algorithm. More information can be found on the Simple Pathfinding page.
CNavArea:ClearSearchLists()
Clears the open and closed lists for a new search. Used in pathfinding via the A* algorithm. More information can be found on the Simple Pathfinding page.
Returns the height difference between the edges of two connected navareas.
Returns the NavDir enum direction that the given vector faces on this CNavArea.
Returns the height difference on the Z axis of the two CNavAreas. This is calculated from the center most point on both CNavAreas.
CNavArea:ConnectTo( CNavArea area )
Connects this CNavArea to another CNavArea or CNavLadder with a one way connection. ( From this area to the target ) See CNavLadder:ConnectTo for making the connection from ladder to area.
boolean CNavArea:Contains( Vector pos )
Returns true if this CNavArea contains the given vector.
CNavArea:Disconnect( CNavArea area )
Disconnects this nav area from given area or ladder. (Only disconnects one way)
CNavArea:Draw()
Draws this navarea on debug overlay.
CNavArea:DrawSpots()
Draws the hiding spots on debug overlay. This includes sniper/exposed spots too!
table CNavArea:GetAdjacentAreaDistances( number dir = nil )
Returns a list of all the CNavAreas that have a one-way connection to this CNavArea and their pre-computed distances. If an area has a one-way incoming connection to this CNavArea, then it will not be returned from this function, use CNavArea:GetIncomingConnectionDistances to get all one-way incoming connections.
Returns a list of all the CNavAreas that have a (one and two way) connection from this CNavArea. If an area has a one-way incoming connection to this CNavArea, then it will not be returned from this function, use CNavArea:GetIncomingConnections to get all one-way incoming connections. See CNavArea:GetAdjacentAreasAtSide for a function that only returns areas from one side/direction.
Returns a table of all the CNavAreas that have a ( one and two way ) connection from this CNavArea in given direction. If an area has a one-way incoming connection to this CNavArea, then it will not be returned from this function, use CNavArea:GetIncomingConnections to get all incoming connections. See CNavArea:GetAdjacentAreas for a function that returns all areas from all sides/directions.
Returns the amount of CNavAreas that have a connection ( one and two way ) from this CNavArea. See CNavArea:GetAdjacentCountAtSide for a function that only returns area count from one side/direction.
Returns the amount of CNavAreas that have a connection ( one or two way ) from this CNavArea in given direction. See CNavArea:GetAdjacentCount for a function that returns CNavArea count from/in all sides/directions.
Returns the attribute mask for the given CNavArea.
Vector CNavArea:GetCenter()
Returns the center most vector point for the given CNavArea.
Returns the closest point of this Nav Area from the given position.
Vector CNavArea:GetCorner( number cornerid )
Returns the vector position of the corner for the given CNavArea.
number CNavArea:GetCostSoFar()
Returns the cost from starting area this area when pathfinding. Set by CNavArea:SetCostSoFar. Used in pathfinding via the A* algorithm. More information can be found on the Simple Pathfinding page.
Returns a table of very bad hiding spots in this area. See also CNavArea:GetHidingSpots.
table CNavArea:GetExtentInfo()
Returns size info about the nav area.
table CNavArea:GetHidingSpots( number type = 1 )
Returns a table of good hiding spots in this area. See also CNavArea:GetExposedSpots.
number CNavArea:GetID()
Returns this CNavAreas unique ID.
Returns a table of all the CNavAreas that have a one-way connection to this CNavArea and their pre-computed distances. If a CNavArea has a two-way connection to or from this CNavArea then it will not be returned from this function, use CNavArea:GetAdjacentAreaDistances to get outgoing (one and two way) connections.
Returns a table of all the CNavAreas that have a one-way connection to this CNavArea. If a CNavArea has a two-way connection to or from this CNavArea then it will not be returned from this function, use CNavArea:GetAdjacentAreas to get outgoing ( one and two way ) connections. See CNavArea:GetIncomingConnectionsAtSide for a function that returns one-way incoming connections from only one side/direction.
Returns a table of all the CNavAreas that have a one-way connection to this CNavArea from given direction. If a CNavArea has a two-way connection to or from this CNavArea then it will not be returned from this function, use CNavArea:GetAdjacentAreas to get outgoing ( one and two way ) connections. See CNavArea:GetIncomingConnections for a function that returns one-way incoming connections from all sides/directions.
table CNavArea:GetLadders()
Returns all CNavLadders that have a ( one or two way ) connection from this CNavArea. See CNavArea:GetLaddersAtSide for a function that only returns CNavLadders in given direction.
table CNavArea:GetLaddersAtSide( number navDir )
Returns all CNavLadders that have a ( one or two way ) connection from ( one and two way ) this CNavArea in given direction. See CNavArea:GetLadders for a function that returns CNavLadder from/in all sides/directions.
CNavArea CNavArea:GetParent()
Returns the parent CNavArea
number CNavArea:GetParentHow()
Returns how this CNavArea is connected to its parent.
string CNavArea:GetPlace()
Returns the Place of the nav area.
Returns a random CNavArea that has an outgoing ( one or two way ) connection from this CNavArea in given direction.
Returns a random point on the nav area.
number CNavArea:GetSizeX()
Returns the width this Nav Area.
number CNavArea:GetSizeY()
Returns the height of this Nav Area.
Returns all possible path segments through a CNavArea, and the dangerous spots to look at as we traverse that path segment.
number CNavArea:GetTotalCost()
Returns the total cost when passing from starting area to the goal area through this node. Set by CNavArea:SetTotalCost. Used in pathfinding via the A* algorithm. More information can be found on the Simple Pathfinding page.
Returns all CNavAreas that are visible from this CNavArea.
number CNavArea:GetZ( Vector pos )
Returns the elevation of this Nav Area at the given position.
boolean CNavArea:HasAttributes( number attribs )
Returns true if the given CNavArea has this attribute flag set.
boolean CNavArea:IsBlocked( number teamID = -2, boolean ignoreNavBlockers = false )
Returns whether the nav area is blocked or not, i. e. whether it can be walked through or not.
boolean CNavArea:IsClosed()
Returns whether this node is in the Closed List. Used in pathfinding via the A* algorithm. More information can be found on the Simple Pathfinding page.
Returns whether this CNavArea can completely (i. e. all corners of this area can see all corners of the given area) see the given CNavArea.
boolean CNavArea:IsConnected( CNavArea navArea )
Returns whether this CNavArea has an outgoing ( one or two way ) connection to given CNavArea. See CNavArea:IsConnectedAtSide for a function that only checks for outgoing connections in one direction.
boolean CNavArea:IsConnectedAtSide( CNavArea navArea, number navDirType )
Returns whether this CNavArea has an outgoing ( one or two way ) connection to given CNavArea in given direction. See CNavArea:IsConnected for a function that checks all sides.
boolean CNavArea:IsCoplanar( CNavArea navArea )
Returns whether this Nav Area is in the same plane as the given one.
boolean CNavArea:IsDamaging()
Returns whether the CNavArea would damage if traversed, as set by CNavArea:MarkAsDamaging.
boolean CNavArea:IsFlat()
Returns whether this Nav Area is flat within the tolerance of the nav_coplanar_slope_limit_displacement and nav_coplanar_slope_limit convars.
boolean CNavArea:IsOpen()
Returns whether this area is in the Open List. Used in pathfinding via the A* algorithm. More information can be found on the Simple Pathfinding page.
Returns whether the Open List is empty or not. Used in pathfinding via the A* algorithm. More information can be found on the Simple Pathfinding page.
boolean CNavArea:IsOverlapping( Vector pos, number tolerance = 0 )
Returns if this position overlaps the Nav Area within the given tolerance.
boolean CNavArea:IsOverlappingArea( CNavArea navArea )
Returns true if this CNavArea is overlapping the given CNavArea.
boolean CNavArea:IsPartiallyVisible( Vector pos, Entity ignoreEnt = NULL )
Returns whether this CNavArea can see given position.
Returns whether this CNavArea can potentially see the given CNavArea.
Returns if we're shaped like a square.
Whether this Nav Area is placed underwater.
boolean CNavArea:IsValid()
Returns whether this CNavArea is valid or not.
boolean, Vector CNavArea:IsVisible( Vector pos )
Returns whether we can be seen from the given position.
CNavArea:MarkAsBlocked( number teamID = -2 )
Marks the area as blocked and unable to be traversed. See CNavArea:IsBlocked and CNavArea:MarkAsUnblocked.
CNavArea:MarkAsDamaging( number duration )
Marks the area as damaging if traversed, for example when, for example having poisonous or no atmosphere, or a temporary fire present. See CNavArea:IsDamaging.
CNavArea:MarkAsUnblocked( number teamID = -2 )
Unblocked this area if it was previously blocked by CNavArea:MarkAsBlocked.
CNavArea:PlaceOnGround( number corner )
Drops a corner or all corners of a CNavArea to the ground below it.
Removes a CNavArea from the Open List with the lowest cost to traverse to from the starting node, and returns it. Used in pathfinding via the A* algorithm. More information can be found on the Simple Pathfinding page.
CNavArea:Remove()
Removes the given nav area.
CNavArea:RemoveAttributes( number attribs )
Removes given attributes from given CNavArea. See also CNavArea:SetAttributes.
We advise against using this. It may be changed or removed in a future update. Does nothing Removes this node from the Closed List. Used in pathfinding via the A* algorithm. More information can be found on the Simple Pathfinding page.
CNavArea:SetAttributes( number attribs )
Sets the attributes for given CNavArea. See CNavArea:HasAttributes.
CNavArea:SetCorner( number corner, Vector position )
Sets the position of a corner of a nav area.
CNavArea:SetCostSoFar( number cost )
Sets the cost from starting area this area when pathfinding. Used in pathfinding via the A* algorithm. More information can be found on the Simple Pathfinding page.
CNavArea:SetParent( CNavArea parent, number how )
Sets the new parent of this CNavArea.
boolean CNavArea:SetPlace( string place )
Sets the Place of the nav area. There is a limit of 256 unique places per . nav file.
CNavArea:SetTotalCost( number cost )
Sets the total cost when passing from starting area to the goal area through this node. Used in pathfinding via the A* algorithm. More information can be found on the Simple Pathfinding page.
CNavArea:UpdateOnOpenList()
Moves this open list to appropriate position based on its CNavArea:GetTotalCost compared to the total cost of other areas in the open list. Used in pathfinding via the A* algorithm. More information can be found on the Simple Pathfinding page.