Add NavigationServer.region_owns_point() helper function

Adds a helper function to check if a world space position is currently owned by a navigation region.
This commit is contained in:
smix8
2022-06-23 19:16:47 +02:00
parent 462127eff0
commit e57360d8df
8 changed files with 39 additions and 0 deletions
+10
View File
@@ -282,6 +282,16 @@
Returns the [code]travel_cost[/code] of this [code]region[/code].
</description>
</method>
<method name="region_owns_point" qualifiers="const">
<return type="bool" />
<argument index="0" name="region" type="RID" />
<argument index="1" name="point" type="Vector2" />
<description>
Returns [code]true[/code] if the provided [code]point[/code] in world space is currently owned by the provided navigation [code]region[/code]. Owned in this context means that one of the region's navigation mesh polygon faces has a possible position at the closest distance to this point compared to all other navigation meshes from other navigation regions that are also registered on the navigation map of the provided region.
If multiple navigation meshes have positions at equal distance the navigation region whose polygons are processed first wins the ownership. Polygons are processed in the same order that navigation regions were registered on the NavigationServer.
[b]Note:[/b] If navigation meshes from different navigation regions overlap (which should be avoided in general) the result might not be what is expected.
</description>
</method>
<method name="region_set_enter_cost" qualifiers="const">
<return type="void" />
<argument index="0" name="region" type="RID" />