Garry's Mod Wiki

navmesh.GetNearestNavArea

  CNavArea navmesh.GetNearestNavArea( Vector pos, boolean anyZ = false, number maxDist = 10000, boolean checkLOS = false, boolean checkGround = true, number team = TEAM_ANY=-2 )

Description

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.

Arguments

1 Vector pos
The position to look from
2 boolean anyZ = false
This argument is ignored and has no effect
3 number maxDist = 10000
This is the maximum distance from the given position that the function will look for a CNavArea
4 boolean checkLOS = false
If this is set to true then the function will internally do a util.TraceLine from the starting position to each potential CNavArea with a MASK_NPCSOLID_BRUSHONLY. If the trace fails then the CNavArea is ignored.

If this is set to false then the function will find the closest CNavArea through anything, including the world.

5 boolean checkGround = true
If checkGround is true then this function will internally call navmesh.GetNavArea to check if there is a CNavArea directly below the position, and return it if so, before checking anywhere else.
6 number team = TEAM_ANY=-2
This will internally call CNavArea:IsBlocked to check if the target CNavArea is not to be navigated by the given team. Currently this appears to do nothing.

Returns

1 CNavArea
The closest CNavArea found with the given parameters, or a NULL CNavArea if one was not found.