Commit graph

71 commits

Author SHA1 Message Date
Rémi Verschelde
faae24637c
Merge pull request #62300 from smix8/navigation_map_force_update_4.x 2022-06-24 10:13:07 +02:00
smix8
e57360d8df 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.
2022-06-23 23:32:05 +02:00
smix8
fdea269805 Add NavigationServer map_force_update() function
Adds map_force_update() function to NavigationServer. This function immediately flushes the Navigationserver command queue and recalculates all navigationmeshes and region connections for a specific map.
2022-06-23 17:32:07 +02:00
Rémi Verschelde
462127eff0
Merge pull request #62312 from smix8/navigation_get_maps_4.x 2022-06-23 16:14:12 +02:00
Rémi Verschelde
bdd41a836c
Merge pull request #62293 from smix8/navigation_disable_editorprogress_bake_4.x 2022-06-23 16:13:12 +02:00
smix8
0c4d99f4fd Implement NavigationMesh bake area
Adds two new properties to NavigationMesh resources to restrict the navmesh baking to an area enclosed by an AABB with volume.
2022-06-23 14:55:21 +02:00
smix8
c0fed1d4e8 Add Navigation function to get all navigation maps
Added new function that returns all created navigation map RIDs from the NavigationServer. The function returns both 2D and 3D created navigation maps as technically there is no distinction between them.
2022-06-22 15:33:40 +02:00
smix8
24bb0af4a9 Disable thread-unsafe EditorProgress for navmesh baking
Disables navmesh baking EditorProgress for now until fixed as EditorProgress is not thread-safe and uses hacks and Main::iteration() for steps which can result in random crashes when baking navmesh.
2022-06-22 10:47:00 +02:00
K. S. Ernest (iFire) Lee
67052af918 Print NavMap error only once for invalid NavMesh. 2022-06-16 13:56:16 +02:00
smix8
245da150e7 Streamline Navigation layer function names.
Streamline Navigation layer function names.
2022-06-15 00:18:48 +02:00
smix8
bc38ebe4f0 Fix crash of navigation agents callback when object is invalid
Fix crash of navigation agents callback when object is invalid.
2022-06-14 13:04:02 +02:00
Rémi Verschelde
4e3b0e176b
Merge pull request #61682 from smix8/navigation_bake_config_precision_4.x 2022-06-08 16:06:00 +02:00
Rémi Verschelde
e4994e2817
Merge pull request #61739 from smix8/navigation_region_cost_4.x 2022-06-08 16:05:38 +02:00
smix8
cfdfd304f1 Add NavigationRegion costs for pathfinding
Add NavigationRegion costs for pathfinding.
2022-06-06 15:25:06 +02:00
smix8
df9919ec33 Add warnings when NavigationMesh bake settings result in precision loss
Add warnings when NavigationMesh bake settings result in precision loss.
2022-06-04 11:31:52 +02:00
smix8
3066091780 Match NavMap and ProjectSettings with NavigationMesh defaults
Match NavMap and ProjectSettings with NavigationMesh defaults since the NavMap edge merging requires a matching cell_size with the NavigationMesh to create connections without issues.
2022-06-03 19:17:49 +02:00
smix8
caceceab08 Fix MultiMeshInstance crash in navmesh baking when MultiMesh Resource is empty
Fix MultiMeshInstance crash in navmesh baking when MultiMesh Resource is empty
2022-05-27 19:35:00 +02:00
Rémi Verschelde
ce069fbe99
Merge pull request #61128 from smix8/navigation_agent_process_mode_4.x 2022-05-19 15:24:34 +02:00
Rémi Verschelde
86cdf1f2cf rvo2: Sync with upstream commit bfc0486
bfc048670a
2022-05-18 14:53:52 +02:00
smix8
6b51ab66d8 Make Navigation Agents and Obstacles respect parent process mode
Temporarily removes agent from navigation map when parent node cannot process due to SceneTree pause and process_mode property. Normal process_mode does not work as other agents would still avoid the paused agents because they were still active on the navigation map and the rvo world. Also fixes potential crash when region_get_map or agent_get_map is called while no map is set.
2022-05-17 20:08:39 +02:00
Rémi Verschelde
eaa4e86433
Merge pull request #61061 from smix8/navigation_mesh_sample_distance_range_4.x 2022-05-16 15:05:17 +02:00
smix8
e33fa9d833 Clamp NavigationMesh sample_distance above zero
While default ReCast library has support for 0.0 'sample_distance' the Godot implementation does not an crashes.
Previously Godot would set all sample_distance values below 0.9 to 0 which causes the crashes.

This limits the sample_distance range selection to 0.1 - 16.0 and also clamps sample_distance that are below 0.1 before ReCast receives them.
2022-05-16 14:25:20 +02:00
Rémi Verschelde
f3c0e75fba
Merge pull request #60958 from smix8/navigation_server_rid_utility_4.x 2022-05-16 13:46:49 +02:00
reduz
746dddc067 Replace most uses of Map by HashMap
* Map is unnecessary and inefficient in almost every case.
* Replaced by the new HashMap.
* Renamed Map to RBMap and Set to RBSet for cases that still make sense
  (order matters) but use is discouraged.

There were very few cases where replacing by HashMap was undesired because
keeping the key order was intended.
I tried to keep those (as RBMap) as much as possible, but might have missed
some. Review appreciated!
2022-05-16 10:37:48 +02:00
smix8
371054e3e5 Add NavigationServer2D/3D API functions to find missing RID info
Utility functions for NavigationServer2D/3D to find missing RID information when working with Server API directly. e.g. from map to regions and agents, from agent or region to map, from region to map and agents and so on ....

Requirement to work with NavigationServer API exklusive without SceneTree nodes and when juggling agents and regions between multiple navigation maps.
2022-05-12 20:23:19 +02:00
smix8
79511af7c9 Add Warning to NavigationMesh bake when source geometry is suspiciously big
Adds Warning when users try to bake a NavigationMesh with suspiciously big source geometry and small cellsizes as this baking process will likely fail or result in a NavigationMesh that will create serious pathfinding performance issues.
2022-05-11 22:06:54 +02:00
reduz
de0ca3b999 Refactor module initialization
* Changed to use the same stages as extensions.
* Makes the initialization more coherent, helping solve problems due to lack of stages.
* Makes it easier to port between module and extension.
* removed the DRIVER initialization level (no longer needed).
2022-05-04 17:34:51 +02:00
trollodel
72c37c4bcd Use CollisionObject3D API when baking the navmesh with static colliders, instead of collecting CollisionShape3D nodes 2022-05-02 08:41:33 +02:00
Rémi Verschelde
8dfa12cae7
Merge pull request #59979 from bruvzg/cpp_check2 2022-04-27 10:08:26 +02:00
bruvzg
40f0b23482
Create NavMap thread pool only when it's used, to prevent creating excessive amount of running threads. 2022-04-26 15:00:00 +03:00
Rémi Verschelde
c45202a89b
Merge pull request #60359 from adamscott/nav-map-thread-work-pool 2022-04-26 11:51:02 +02:00
Pawel Lampe
66856d5fb0 Fix crash in GodotNavigationServer::map_get_path 2022-04-22 18:49:45 +02:00
bruvzg
de4c97758a
Fix more issues found by cppcheck. 2022-04-20 10:34:00 +03:00
Adam Scott
732102cbc5 Use ThreadWorkPool instead of thread_process_array in NavMap 2022-04-19 18:35:15 -04:00
kleonc
9ab69b89f8 NavMap::get_path Fix not resetting least_cost_id 2022-04-14 17:13:53 +02:00
Pawel Lampe
fcd26b8841 Fix navmesh baking
- improved mesh data calculation from standalone static colliders so that no
  VisualServer calls are performed - and thus no VS mutexes need to
  be locked in case of on-thread baking
- improved the same for GridMap's static colliders
2022-04-08 21:01:59 +02:00
bruvzg
f851c4aa33
Fix some issues found by cppcheck. 2022-04-06 14:34:37 +03:00
Pawel Lampe
dcab82ad43 Fix get_simple_path behavior in 2D & 3D 2022-04-05 23:26:37 +02:00
Rémi Verschelde
b78aa4fe19 Style: Apply clang-tidy to current code, add readability-redundant-member-init 2022-04-04 21:49:51 +02:00
Rémi Verschelde
f8ab79e68a Zero initialize all pointer class and struct members
This prevents the pitfall of UB when checking if they have been
assigned something valid by comparing to nullptr.
2022-04-04 19:49:50 +02:00
Rémi Verschelde
5fe6984639 Modules: Don't build editor-specific classes in templates
They're moved to an `editor` subfolder so that we can easily handle them
separately.
2022-03-28 16:48:15 +02:00
reduz
21637dfc25 Remove VARIANT_ARG* macros
* Very old macros from the time Godot was created.
* Limited arguments to 5 (then later changed to 8) in many places.
* They were replaced by C++11 Variadic Templates.
* Renamed methods that take argument pointers to have a "p" suffix. This was used in some places and not in others, so made it standard.
* Also added a dereference check for Variant*. Helped catch a couple of bugs.
2022-03-09 18:39:13 +01:00
Rémi Verschelde
e031aa06ee Core: Use forward declares for Vector3/Vector3i
Add add Vector3 operator in Vector3i.
2022-02-19 16:47:24 +01:00
Jakob Bouchard
6553f5c242
Convert _notification methods to switch - Chunk C 2022-02-16 13:03:05 -05:00
Rémi Verschelde
11572c6e30
Editor: Cleanup some includes dependencies
Removes some unnecessary includes from `editor_node.h`, and instead add
those where they're used.

Removes unnecessary `editor_node.h` includes in various editor classes.

Renames `dynamicfont` to `dynamic_font` in a couple files.

Misc cleanup while jumping through that rabbit hole.
2022-02-15 14:54:15 +01:00
trollodel
cd1d7294d8 Remove the EditorNode parameter from EditorPlugins create methods
Remove EditorNode usage from the Navigation editor plugin.
2022-02-14 18:21:42 +01:00
kleonc
5422d863e1 NavMap Fix polygons being treated like triangle strips instead of triangle fans 2022-02-13 19:26:17 +01:00
Hendrik Brucker
b396fd4eef Improve compilation speed (forward declarations/includes cleanup) 2022-02-12 02:46:22 +01:00
Pawel Lampe
a30dd094d3 Fix transforms involved into navmesh baking
Within the context of parsing navigation geometry, this commit:
- added missing transform of `MultiMeshInstance`
- changed all transforms to global ones so that they don't need to be
  calculated by hand
2022-01-31 23:07:45 +01:00
rafallus
cc46abd73d Consider gridmap collisions in navigation bake 2022-01-16 18:56:10 -06:00