Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Godot 4 Gridmap navigation - agent ignores target and moves to Gridmap's origin instead. #56099

Closed
macryc opened this issue Dec 20, 2021 · 3 comments · Fixed by #61797
Closed

Comments

@macryc
Copy link

macryc commented Dec 20, 2021

Godot version

v4.0.dev.calinou.f09d88443

System information

Win10, GLES3, RTX 2070 mobile

Issue description

When using 3d gridmap with per-tile navmesh, the agent doesn't move towards the target. Instead it moves towards the center of the gridmap node.

Steps to reproduce

  1. Start a 3d scene, create a mesh instance - plane
  2. Duplicate the mesh, turn one into a navigation mesh (Mesh > Create Navigation Mesh) and make it a child of the first one
  3. Turn the other into a Trimesh Static Body).
  4. Convert the scene into a mesh library.
  5. start a new scene
  6. create a characterbody3d with capsule mesh, attach the player script (project attached hereto)
  7. create a navigationagent3d as a child of the characterbody3d and connect to the function in the script
  8. create a gridmap, load the mesh library (make sure the tile has a navmesh - sometimes it doesn't save when converting scene to mesh lib)
  9. draw some tiles on the grid
  10. put the character on the grid
  11. create a 3d node for target and place it somewhere on the grid
  12. run the game - the character node will move towards the center of the grid map, ignoring its target completely

Minimal reproduction project

Navitest.zip

@Calinou
Copy link
Member

Calinou commented Dec 20, 2021

4.0 dev

Please edit your issue to specify the exact build commit, as 4.0.dev is a moving target. You can copy the build version by clicking the version identifier at the bottom of the editor, in the project manager or in the About dialog.

@macryc
Copy link
Author

macryc commented Dec 20, 2021

4.0 dev

Please edit your issue to specify the exact build commit, as 4.0.dev is a moving target. You can copy the build version by clicking the version identifier at the bottom of the editor, in the project manager or in the About dialog.

Done. This issue is actually also present in multiple other builds.

@smix8
Copy link
Contributor

smix8 commented May 20, 2022

The GridMap does not build and register the NavigationMeshes correctly on the NavigationServer so the grid cell navregions are never merged and the only point available on the navigation is the scene origin in the center.

The first issue is that the "bake_navigation" stores NavigationMeshes that do not fit their own properties, especially when imported from another software the mesh has nothing to do with the NavigationMesh properties so when the NavigationServer wants to merge the regions based on e.g. cell_size and other properties it fails with a million error messages.

The seconds issue is that the GridMap does not add or update the navregions correctly when joining the SceneTree.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
3 participants