Commit graph

55 commits

Author SHA1 Message Date
Josh Jones
097f8a5fdb Fix missing avoidance updates when using same velocity
When using avoidance, if you set the same velocity for the agent, you won't get an update from the avoidance system.

This changes both the `set_target_position` and `set_velocity` setters to always accept user provided values, even if they are the same. This ensures that repathing and avoidance logic is always run when the user expects.
2023-02-08 23:18:53 -08:00
Josh Jones
20fdfd466b Improve consistency of NavigationAgent setters 2023-02-02 22:51:37 -08:00
Rémi Verschelde
e52213e2fa
More codespell fixes, do more changes from previous ignore list 2023-02-01 12:11:36 +01:00
smix8
0ab764e84b Add NavigationAgent Path Debug Visualization
Adds path debug visuals for NavigationAgent2D, NavigationAgent3D and NavigationServer.
2023-01-31 18:27:35 +01:00
Josh Jones
22f9ef19e1 Use Callable for Navigation Agent callbacks 2023-01-27 23:14:36 -08:00
smix8
bf1571979c Rename Navigation uses of 'location' to 'position'
Contrary to the entire rest of the engine NavigationAgent's and NavigationLinks decided to deal with locations instead of positions.
2023-01-26 18:19:03 +01:00
Rémi Verschelde
d95794ec8a
One Copyright Update to rule them all
As many open source projects have started doing it, we're removing the
current year from the copyright notice, so that we don't need to bump
it every year.

It seems like only the first year of publication is technically
relevant for copyright notices, and even that seems to be something
that many companies stopped listing altogether (in a version controlled
codebase, the commits are a much better source of date of publication
than a hardcoded copyright statement).

We also now list Godot Engine contributors first as we're collectively
the current maintainers of the project, and we clarify that the
"exclusive" copyright of the co-founders covers the timespan before
opensourcing (their further contributions are included as part of Godot
Engine contributors).

Also fixed "cf." Frenchism - it's meant as "refer to / see".
2023-01-05 13:25:55 +01:00
Adam Scott
ea33001b95 Add safety-checks before some servers free() 2022-12-29 16:23:38 -05:00
Rémi Verschelde
f84c308cf8
Merge pull request #69688 from smix8/navagent_stop_origin_automove_4.x
Stop NavigationAgents without a target from moving to world origin
2022-12-21 19:39:25 +01:00
Josh Jones
5d8ba2b2d1 Add support for emitting a signal when entering a NavLink 2022-12-17 16:33:41 -08:00
smix8
34e7628f5f Fix Navigation API abbreviations inconsistency
Schema for navigation to name user facing API with  "navigation" without abbreviation and e.g. NavigationServer internals with abbr "nav".
2022-12-17 22:06:22 +01:00
smix8
194c1c44e0 Fix Navigation agent callback wild pointer crash
Fixes crash in sanitizer builds when callback agent or object are already freed.
2022-12-12 13:03:55 +01:00
smix8
860379fc16 Stop NavigationAgents without a target from moving to world origin
Stops NavigationAgents moving to the world origin without anyone telling them to do so.
2022-12-06 22:53:18 +01:00
Rémi Verschelde
0844f0ed10
Merge pull request #65452 from timothyqiu/agent-target
Make NavigationAgent `target_location` a property
2022-10-31 11:56:17 +01:00
Sam Briels
815231943b Emit target_reached signal after state is updated 2022-10-27 14:05:43 +02:00
Haoyu Qiu
e4100495b5 Make NavigationAgent target_location a property 2022-10-27 13:51:38 +08:00
Josh Jones
a2c53b881b Update NavigationAgent to use query_path
This paves the way for having agents respond to link traversal.
2022-09-28 23:01:12 -06:00
Marc Gilleron
aed3822a93 Change return type of get_configuration_warnings to PackedStringArray 2022-09-19 16:43:15 +01:00
Micky
b62d06fbed Rename Navigation's neighbor_dist to neightbor_distance
NavigationAgent2D/3D.`neighbor_dist` -> `neighbor_distance` (also affects setters and getters)

NavigationServer2D/3D.`agent_set_neighbor_dist()` -> `agent_set_neighbor_distance()`

Also changes their parameters' names.

Doesn't affect "Agent.neighborDist_" in Agent.h
2022-08-13 12:40:55 +02:00
smix8
dde09be302 Group NavigationAgent properties
Groups the ill-defined NavigationAgent properties between pathfinding and avoidance to make it more clear which property affects what.
2022-06-29 18:42:51 +02:00
Rémi Verschelde
21b0c7fc22
Merge pull request #62214 from smix8/navigation_layer_bitmask_helpers_4.x 2022-06-20 15:13:33 +02:00
smix8
55923ade68 Add navigation layer bitmask helper functions
Adds helper functions to work with the navigation layer bitmask.
2022-06-19 13:47:19 +02:00
smix8
07740302f3 Add NavigationAgent desired path distance
Add NavigationAgent desired path distance
2022-06-18 19:11:49 +02:00
smix8
245da150e7 Streamline Navigation layer function names.
Streamline Navigation layer function names.
2022-06-15 00:18:48 +02:00
smix8
f10ff0efda Add NavigationAgent set_navigation_map() function
Add NavigationAgent set_navigation_map() and get_navigation_map() function.
2022-06-14 21:48:47 +02:00
smix8
56fe26b5e0 Fix NavigationAgent reparent issues
Fix NavigationAgent reparent issues
2022-06-01 06:45:12 +02:00
smix8
7f3688603c Process NavigationAgent2D/3D avoidance on demand only
Changes NavigationAgent avoidance callback to a toggle that is disabled by default.
Also fixes a few missing descriptions / wrong warnings.
2022-05-20 23:47:10 +02:00
Aaron Franke
5dc3bfb80e
Use suffixes for units in nodes and resources 2022-05-19 14:34:27 -05: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
26048c805b
Merge pull request #59331 from bartekd97/navigation-agent-layers 2022-04-01 13:35:51 +02:00
Rémi Verschelde
7119d355eb String: Remove TTR and DTR defines in non-tools build
This ensures we don't use TTR in runtime code, as it's specifically meant
to source translations for the editor.
2022-03-28 20:26:35 +02:00
BARTEK-PC\Bartek
4972f1b864 Expose navigable layers for NavigationAgent2D/3D 2022-03-20 15:04:56 +01:00
Rémi Verschelde
0f5455230c
Use switch consistently in _notification (scene folder) 2022-02-15 18:44:55 +01:00
Rémi Verschelde
fe52458154
Update copyright statements to 2022
Happy new year to the wonderful Godot community!
2022-01-03 21:27:34 +01:00
Duroxxigar
54d305eebe Improved readability for failing error conditions 2021-10-08 17:29:25 -04:00
Aaron Franke
eb4902a455
Fix some unnecessary includes 2021-08-13 00:27:38 -05:00
reduz
6631f66c2a Optimize StringName usage
* Added a new macro SNAME() that constructs and caches a local stringname.
* Subsequent usages use the cached version.
* Since these use a global static variable, a second refcounter of static usages need to be kept for cleanup time.
* Replaced all theme usages by this new macro.
* Replace all signal emission usages by this new macro.
* Replace all call_deferred usages by this new macro.

This is part of ongoing work to optimize GUI and the editor.
2021-07-18 21:20:02 -03:00
smix8
67b4f9f76a Fix NavigationAgent3D not emitting "target_reached" Signal
Fix NavigationAgent3D not emitting "target_reached" Signal when reaching pathfinding target.
2021-04-27 12:31:50 +02:00
smix8
15bf337474 Fix broken NavigationAgent3D collision avoidance callback
Fix broken NavigationAgent3D collision avoidance callback
2021-04-19 23:48:28 +02:00
Nathan Franke
2a8c59c171
Use Array for node configuration warnings
Previously, the warnings were passed as a string and delimitation of which were hard coded at each implementation.
2021-04-11 23:25:38 -05:00
Gilles Roudière
a9dc53d152 Remove Navigation2D/3D nodes, and move the navigation map to the world resource 2021-03-10 11:23:06 +01:00
Rémi Verschelde
b5334d14f7
Update copyright statements to 2021
Happy new year to the wonderful Godot community!

2020 has been a tough year for most of us personally, but a good year for
Godot development nonetheless with a huge amount of work done towards Godot
4.0 and great improvements backported to the long-lived 3.2 branch.

We've had close to 400 contributors to engine code this year, authoring near
7,000 commit! (And that's only for the `master` branch and for the engine code,
there's a lot more when counting docs, demos and other first-party repos.)

Here's to a great year 2021 for all Godot users 🎆
2021-01-01 20:19:21 +01:00
Marcel Admiraal
5b937d493f Rename empty() to is_empty() 2020-12-28 10:39:56 +00:00
reduz
127458ed17 Reorganized core/ directory, it was too fatty already
-Removed FuncRef, since Callable makes it obsolete
-Removed int_types.h as its obsolete in c++11+
-Changed color names code
2020-11-07 20:17:12 -03:00
Rémi Verschelde
12091b39d2
Merge pull request #38743 from arrowinaknee/node-config-warnings
Update all get_configuration_warning() to retrieve warnings from the parent
2020-10-01 14:03:29 +02:00
Andrii Doroshenko (Xrayez)
69d5de632e Split Geometry singleton into Geometry2D and Geometry3D
Extra `_2d` suffixes are removed from 2D methods accoringly.
2020-05-27 14:28:34 +03:00
ArrowInAKnee
9fc2b0fddc Update all get_configuration_warning to retrieve warnings from the parent 2020-05-16 16:07:42 +03:00
Rémi Verschelde
0ee0fa42e6 Style: Enforce braces around if blocks and loops
Using clang-tidy's `readability-braces-around-statements`.
https://clang.llvm.org/extra/clang-tidy/checks/readability-braces-around-statements.html
2020-05-14 21:57:34 +02:00
Rémi Verschelde
0be6d925dc Style: clang-format: Disable KeepEmptyLinesAtTheStartOfBlocks
Which means that reduz' beloved style which we all became used to
will now be changed automatically to remove the first empty line.

This makes us lean closer to 1TBS (the one true brace style) instead
of hybridating it with some Allman-inspired spacing.

There's still the case of braces around single-statement blocks that
needs to be addressed (but clang-format can't help with that, but
clang-tidy may if we agree about it).

Part of #33027.
2020-05-14 16:54:55 +02:00
Rémi Verschelde
1f6f364a56 Port member initialization from constructor to declaration (C++11)
Using `clang-tidy`'s `modernize-use-default-member-init` check and
manual review of the changes, and some extra manual changes that
`clang-tidy` failed to do.

Also went manually through all of `core` to find occurrences that
`clang-tidy` couldn't handle, especially all initializations done
in a constructor without using initializer lists.
2020-05-14 10:01:56 +02:00