Garry's Mod Wiki

Revision Difference

navmesh.GetNearestNavArea#516829

<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> </args> <rets> <ret name="" type="CNavArea">The closest <page>CNavArea</page> found with the given parameters.</ret> </rets> </function> ⤶ <arg⤶ |type=boolean⤶ |name=checklos⤶ |desc=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.>⤶ <default>false</default>⤶ ⤶ </arg⤶ |type=boolean⤶ |name=checklos⤶ |desc=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.>