Closed JekSun97 closed 2 weeks ago
There are a few reasons for this, but it's not a bug. It's a lot clearer why it happens if you make navigation visible:
https://github.com/TokisanGames/Terrain3D/assets/165720/d1867aca-105f-45ea-9171-cde7d0e39bb9
The blue mesh that covers the ground is the navigation mesh. The RuntimeNavigationBaker script periodically rebakes this on a thread. You can adjust the "bake cooldown" on the baker to do this more frequently, but you'll still run into the fact that baking navigation is just slow. This is why editor/compile-time baking navigation is usually a better option for games (where that can be done).
However, runtime baking can still be usable. There are a few things you can do to speed it up, or work around the slowness:
mesh_size
).cell_size
), to reduce the amount of work to do. But note that if you increase it too far, obstacles may hide within a cell and break your navigation. You can write fallback behaviors for that, or you can ensure your obstacles are all larger than the cell size.A second, smaller delay is due to how frequently the navigation agent updates its path. You can do this more frequently by adjusting the RETARGET_COOLDOWN
constant (currently 1.0 seconds), but if you have a lot of agents that's going to come with a performance cost.
Thanks, I think this should be mentioned somewhere in the documentation
@tcoxon Thanks for looking at it and providing the explanation.
Docs updated in https://github.com/TokisanGames/Terrain3D/commit/15ff7e5b89dfc58fd6d9336924679a6780ef111e
Terrain3D version
v0.9.2-dev
System information
Godot v4.2.2.stable - Windows 10.0.19045 - Vulkan (Forward+) - dedicated Radeon RX 560 Series (Advanced Micro Devices, Inc.; 31.0.14001.45012) - Intel(R) Core(TM) i5-4570 CPU @ 3.20GHz (4 Threads)
Is the issue reproducable in the demo?
Yes
Issue description
When I started the CodeGenerated.tscn demo, the agent’s path search was intermittent with long delays, there were times when the agent stood next to me and for about 6 seconds could not find the path to me
https://github.com/TokisanGames/Terrain3D/assets/130399274/418d7c81-55e4-4728-9baa-b0a35c28b16e
Logs
Empty