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

Navmesh doesn't always update when obstacles change #55

Open
Shatur opened this issue Sep 19, 2024 · 2 comments · May be fixed by #56
Open

Navmesh doesn't always update when obstacles change #55

Shatur opened this issue Sep 19, 2024 · 2 comments · May be fixed by #56

Comments

@Shatur
Copy link
Contributor

Shatur commented Sep 19, 2024

I recently tried switching from oxidized_navigation to vleue_navigator. However, I noticed that the navmesh doesn't update, and #54 didn't fix the issue. So, I switched back to oxidized_navigation in this commit.

@mockersf asked me on Discord if he could try running the project before the commit. Since I’ve fixed quite a few bugs since then, I decided to create a separate branch with this commit reverted and rebased onto the latest master: #330. Hopefully, this will help determine whether it's a bug or an API misuse on my part.

Below are the steps to reproduce. It requires a bit of setup when you try it for the first time :)

  1. cargo run if you running it for the first time. Next time run cargo run -- play --world-name "New world" family "New family" instead and jump directly to step 16. You may also want to run with RUST_LOG=project_harmonia_base=debug to tracing.
  2. Click on "Play":
    Screenshot_20240919_022120
  3. First we need to create a world. Just click on "Create":
    image
  4. Confirm creation, just leave the default name:
    image
  5. Now we need to create a city first. Not very intuitive, but select cities tab first:
    image
  6. Press "Create":
    image
  7. Confirm creation, just leave the default name:
    image
  8. Now switch back to the families tab:
    image
  9. Click on "Create new":
    image
  10. It's a stub for character creation screen 😅 Just click on "Confirm":
    image
  11. Confirm the family name:
    image
  12. Now click on "Place & save":
    image
  13. Press Esc and click on "Save". It's very important, if you exit the game the world won't be saved!
    image
  14. (Optional) You probably want to see navigation paths and navmesh. Let's enable them. Press Esc and click on "Settings":
    image
  15. (Optional) Navigate to developer tab:
    image
  16. (Optinal) Tick the needed checkboxes and press "Ok":
    image
  17. Now in order to place walls you need to enter build mode:
    image
  18. Select walls:
    image
  19. Click anywhere to start placing a wall:
    image
  20. Click anywhere again to confirm placing. You can already see that the navmesh is not updated. Let's try to move a character, back to the family mode:
    image
  21. Click somewhere behind the wall and select "Walk here".
    image
  22. You can see how the character goes through the wall:
    image

Since I have networking and serialization, I use the blueprint pattern, which is basically "required components at home". For walls you can see that an empty collider is inserted here. And collision is updated here on the wall change.
Let me know any questions :)

After writing this I started to doubt that it's the best way to debug the issue 😆 Maybe it's simpler to just create a simple example with a changing mesh.

@mockersf mockersf linked a pull request Sep 20, 2024 that will close this issue
@mockersf
Copy link
Member

mockersf commented Sep 20, 2024

Does #56 fixes it for you?

On my local it works and navmesh updates are almost instant

project_harmonia.mp4

@Shatur
Copy link
Contributor Author

Shatur commented Sep 20, 2024

Ah, yes, setting upward_shift to 0.1 fixes the issue, thank you! I tried it before, but with negative values 😅 Looks like navmesh now always updates, we can close this issue.

But I faced another issue, I trying to run the world from this post, but character is unable to walk through doors with weird errors:

2024-09-20T07:53:38.122797Z ERROR polyanya: Search from (-24.823553, -15.517356) to (-18.67345, -31.258448) failed. Please check the mesh is valid as this should not happen. 

When a door is placed on a wall, it splits the collider using width from the placed object:
image
Ignore the door collision, it's a bit broken, but it doesn't affect navigation, only walls are marked as Obstacle.

Here is the scene:
New world.zip
The game uses standard paths to store data, so on Linux it's ~/.config/project_harmonia_base/worlds/ (I use crate name, but recently refactored into multiple crates, need to fix it 😄).

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

Successfully merging a pull request may close this issue.

2 participants