Commit graph

41 commits

Author SHA1 Message Date
smix8
17e6d76de6 Fix Navigation agent callback wild pointer crash
Fixes crash in sanitizer builds when callback agent or object are already freed.

(cherry picked from commit 194c1c44e0)
2022-12-18 10:32:04 +08:00
Haoyu Qiu
37ccdb201a Backport navigation crash fixes
Co-Authored-By: Sean <sean@geekotron.net>
2022-11-22 12:46:43 +08:00
smix8
f15cb16b14 Fix avoidance calculation on NO_THREADS build 2022-10-03 13:39:48 +02:00
smix8
ce310c1e39 Exclude disabled CollisionShapes from Navigationmesh baking
Excludes disabled CollisionShapes from the geometry parsing for the NavigationMesh baking.

(cherry picked from commit 534ff93b05)
2022-09-20 10:26:17 +02:00
Cory Petkovsek
d7ba3b73a9 Clarify invalid RID errors in Server free() functions. 2022-08-12 23:02:09 +08:00
Rémi Verschelde
5834c27e85
Merge pull request #63935 from smix8/navigation_heightmapshape_baking_3.x 2022-08-08 15:47:24 +02:00
Rémi Verschelde
d9d3861f76
Merge pull request #55764 from tinmanjuggernaut/validate_rid
[3.x] Validate RIDs before freeing
2022-08-05 22:38:49 +02:00
smix8
e7c5468192 [3.x] Add NavigationMesh baking for HeightMapShape
Adds HeightMapShape for StaticColliders and GridMap to the NavigationMeshGenerator for baking NavigationMesh.
2022-08-05 08:56:02 +02:00
smix8
d0a78d05eb [3.5] Replace Navigation std::vector use with LocalVector
Replace Navigation std::vector use with LocalVector.
2022-07-29 11:13:20 +02:00
Rémi Verschelde
818f1eed31 Code quality: Fix header guards consistency
Adds `header_guards.sh` bash script, used in CI to validate future
changes. Can be run locally to fix invalid header guards.
2022-07-25 14:53:37 +02:00
smix8
721c99a530 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.

(cherry picked from commit fdea269805)
2022-06-24 10:19:00 +02:00
smix8
f0069cc1e9 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.

(cherry picked from commit e57360d8df)
2022-06-24 10:19:00 +02:00
smix8
38ee593b76 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.

(cherry picked from commit c0fed1d4e8)
2022-06-23 16:29:11 +02:00
smix8
7bcb9fddc9 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.

(cherry picked from commit 24bb0af4a9)
2022-06-23 16:29:11 +02:00
smix8
fcff804844 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.

(cherry picked from commit 0c4d99f4fd)
2022-06-23 16:17:43 +02:00
K. S. Ernest (iFire) Lee
bcd92b8aa0 Print NavMap error only once for invalid NavMesh.
(cherry picked from commit 67052af918)
2022-06-16 20:47:40 +02:00
smix8
b0a8bcdf49 Fix crash of navigation agents callback when object is invalid
Fix crash of navigation agents callback when object is invalid.

(cherry picked from commit bc38ebe4f0)
2022-06-16 10:03:18 +02:00
smix8
8bd7c6188b [3.5] Update NavigationServer backport
Backports features and bugfixes from current Godot 4.0 to 3.5 and brings functions and codebase of both version largely in sync to make tutorials more compatible and future backports easier.
2022-06-14 05:55:14 +02:00
smix8
47ade6786f Fix MultiMeshInstance crash in navmesh baking when MultiMesh Resource is empty
Fix MultiMeshInstance crash in navmesh baking when MultiMesh Resource is empty

(cherry picked from commit caceceab08)
2022-06-01 00:29:46 +02:00
smix8
88acb5b798 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.

(cherry picked from commit 6b51ab66d8)
2022-05-19 15:34:56 +02:00
Rémi Verschelde
52da1bcdca rvo2: Sync with upstream commit bfc0486
bfc048670a
(cherry picked from commit 86cdf1f2cf)
2022-05-19 15:25:43 +02:00
smix8
3e01d32b4c 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.

(cherry picked from commit e33fa9d833)
2022-05-16 21:10:36 +02:00
smix8
3977eb9107 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.

(cherry picked from commit 371054e3e5)
2022-05-16 21:10:36 +02:00
smix8
689179036b 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.

(cherry picked from commit 79511af7c9)
2022-05-16 17:14:43 +02:00
Cory Petkovsek
2be0738304 Visual/Physics/Navigation Servers validate RIDs with documentation update 2022-05-06 03:39:06 +08:00
trollodel
7c400b3ea0 Use CollisionObject3D API when baking the navmesh with static colliders, instead of collecting CollisionShape3D nodes
(cherry picked from commit 72c37c4bcd)
2022-05-05 14:07:56 +02:00
Rémi Verschelde
ba7881bd36
Merge pull request #60366 from adamscott/nav-map-thread-work-pool-3x
Use ThreadWorkPool instead of thread_process_array in NavMap [3.x]
2022-04-26 18:45:53 +02:00
Adam Scott
7749346f48 Use ThreadWorkPool instead of thread_process_array in NavMap
Port ThreadWorkPool to 3.x
2022-04-26 09:18:46 -04:00
Pawel Lampe
41d788375a Fix crash in GodotNavigationServer::map_get_path, fixes #60413 2022-04-22 18:19:11 +02:00
kleonc
c52d842435 NavMap::get_path Fix not resetting least_cost_id 2022-04-14 17:15:39 +02:00
Pawel Lampe
3035b9c44c Fix navmesh baking, fixes #57148
- 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-02 23:20:41 +02:00
Pawel Lampe
c0d9e4fd07 Fix get_simple_path behavior in 2D, fixes #56852 2022-02-17 18:23:34 +01:00
kleonc
ff06d0978a NavMap Fix polygons being treated like triangle strips instead of triangle fans 2022-02-14 18:22:02 +01:00
Pawel Lampe
6c6e50bf0c Fix navigation merge errors, fixes #56786
- improved `detail/sample_max_error` default value
- improved floating point precision handling in cell key calculations
- improved `merge error` error message
- exposed `cell_height` of `nav_map` to the `Navigation`
- fixed cell key `y` calculation
2022-02-02 23:52:29 +01:00
Pawel Lampe
4d8e6fdd2d Fix transforms involved into navmesh baking
fixes #57231, fixes #57421

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-30 12:23:53 +01:00
Yuri Sizov
797bb1d97e Ensure that NavMesh baking updates the inspector 2022-01-26 01:16:50 +03:00
rafallus
75fcb31cee [3.x] Consider gridmap collisions in navigation bake 2022-01-24 19:10:33 -06:00
Dardan Bujupaj
752fbc7f4e Fix indexing of polygon points when building path. 2022-01-19 23:39:43 +01:00
Rémi Verschelde
a627cdafc5
Update copyright statements to 2022
Happy new year to the wonderful Godot community!
2022-01-13 15:54:13 +01:00
Rémi Verschelde
b197de6f5f
Fix typos with codespell
Using codespell 2.1.0.

Method:
```
$ cat > ../godot-word-whitelist.txt << EOF
ang
curvelinear
dof
doubleclick
fave
findn
GIRD
leapyear
lod
merchantibility
nd
numer
ois
ony
que
readded
seeked
statics
synching
te
uint
unselect
webp
EOF

$ codespell -w -q 3 -I ../godot-word-whitelist.txt --skip="./thirdparty,*.po"
$ git diff // undo unwanted changes
```
2022-01-07 00:14:54 +01:00
Jake Young
09bc9eb101
Backport NavigationServer with RVO2 to 3.x
Change the entire navigation system.
Remove editor prefix from nav mesh generator class. It is now used for baking
at runtime as well.
Navigation supports obstacle avoidance now with the RVO2 library.
Nav system will also automatically link all nav meshes together to form one
overall complete nav map.
2022-01-05 16:00:56 +01:00