Garry's Mod Wiki

Revision Difference

navmesh.GetNearestNavArea#518569

<function name="GetNearestNavArea" parent="navmesh" type="libraryfunc"> <description> Returns the closest <page>CNavArea</page> to given position at the same height, or beneath it. This function will ignore blocked <page>CNavArea</page>s. See <page>navmesh.GetNavArea</page> for a function that does see blocked areas. </description> <realm>Server</realm> <args> <arg name="pos" type="Vector">The position to look from</arg> <arg name="anyZ" type="boolean" default="false">This argument is ignored and has no effect</arg> <arg name="maxDist" type="number" default="10000">This is the maximum distance from the given position that the function will look for a &lt;page&gt;CNavArea&lt;/page&gt;</arg>⤶ <arg name="checkLOS" type="boolean" default="false">If this is set to true then the function will internally do a &lt;page&gt;util.TraceLine&lt;/page&gt; from the starting position to each potential &lt;page&gt;CNavArea&lt;/page&gt; with a MASK_NPCSOLID_BRUSHONLY &lt;page&gt;MASK|Test&lt;/page&gt;. If the trace fails then the &lt;page&gt;CNavArea&lt;/page&gt; is ignored.&#xA;&#xA;If this is set to false then the function will find the closest &lt;page&gt;CNavArea&lt;/page&gt; through anything, including the world.</arg>⤶ <arg name="checkGround" type="boolean" default="true">If checkGround is true then this function will internally call &lt;page&gt;navmesh.GetNavArea&lt;/page&gt; to check if there is a &lt;page&gt;CNavArea&lt;/page&gt; directly below the position, and return it if so, before checking anywhere else.</arg> <arg name="team" type="number" default="TEAM_ANY=-2">This will internally call &lt;page&gt;CNavArea:IsBlocked&lt;/page&gt; to check if the target &lt;page&gt;CNavArea&lt;/page&gt; is not to be navigated by the given team. Currently this appears to do nothing.</arg> <arg name="maxDist" type="number" default="10000">This is the maximum distance from the given position that the function will look for a <page>CNavArea</page></arg>⤶ <arg name="checkLOS" type="boolean" default="false">If this is set to true then the function will internally do a <page>util.TraceLine</page> from the starting position to each potential <page>CNavArea</page> with a MASK_NPCSOLID_BRUSHONLY <page>MASK|Test</page>. If the trace fails then the <page>CNavArea</page> is ignored.⤶ If this is set to false then the function will find the closest <page>CNavArea</page> through anything, including the world.</arg> <arg name="checkGround" type="boolean" default="true">If checkGround is true then this function will internally call <page>navmesh.GetNavArea</page> to check if there is a <page>CNavArea</page> directly below the position, and return it if so, before checking anywhere else.</arg> <arg name="team" type="number" default="TEAM_ANY=-2">This will internally call <page>CNavArea:IsBlocked</page> to check if the target <page>CNavArea</page> is not to be navigated by the given team. Currently this appears to do nothing.</arg>⤶ </args> <rets> <ret name="" type="CNavArea">The closest <page>CNavArea</page> found with the given parameters.</ret> </rets> </function>