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

Nagivation doesnt work with static meshes #2326

Open
YerkoAndrei opened this issue Jun 13, 2024 · 10 comments
Open

Nagivation doesnt work with static meshes #2326

YerkoAndrei opened this issue Jun 13, 2024 · 10 comments
Labels
bug Something isn't working

Comments

@YerkoAndrei
Copy link
Contributor

Release Type: Official Release

Version: 4.2.0.2149

Platform(s): Windows

Describe the bug
Nagivation mesh ignore all static meshes

To Reproduce
Steps to reproduce the behavior:

  1. Create new project
  2. Add simple navigation configuration as in the official tutorial
  3. Add a plane and some cube
  4. Add static colliders for both
  5. Add infinite mesh to plane
  6. On collider shapes of the cube, add static mesh and reference itself

Expected behavior
Navigation mesh should update and use the cube as a wall or obstacle

Screenshots
With static mesh
1

With cube shape (how it should look)
2

Additional context

  • Its not a visual problem, characters navigation doesnt work
  • Using a convex hull works good, but it cant be used as a workaround
  • Creating a collider shape asset doesnt work
  • I tried on master and it doesnt work either
@YerkoAndrei YerkoAndrei added the bug Something isn't working label Jun 13, 2024
@Doprez
Copy link
Contributor

Doprez commented Jun 13, 2024

If you enlarge the box does the mesh still work with the surface of the mesh? Im curious because I know I used a static mesh at one point for terrain on the old recast nav mesh and it worked for that at least.

@YerkoAndrei
Copy link
Contributor Author

Nope, i cant make it work, i have tried with fbx and glb, so its not that.

Im looking the code and the ColliderShape of the StaticCollider is alway null when using a StaticMesh. I think thats the problem.
When the PhysicsComponent try to ComposeShape, it call CreateShape with a null service, wich is only used by Asset and StaticMesh (just these 2 fails).
I dont undestand yet what is an EntityManager and why is null, so if someone know someting related please help.

@Doprez
Copy link
Contributor

Doprez commented Jun 24, 2024

I should be able to look into this a bit this week. The file type should not matter so long as the collider is created, it uses the information from Bullet to create the nav mesh.

Can you also try to downgrade your project to 4.2.0.2122? Im wondering if one of the PRs may have had a larger affect than intended. #2262

@YerkoAndrei
Copy link
Contributor Author

tried 4.2.0.2188, 4.2.0.2149, 4.2.0.2122 and 4.2.0.2042, not working on any

@Doprez
Copy link
Contributor

Doprez commented Jun 29, 2024

got it working in my branch https://github.com/Doprez/stride/tree/fix-static-collider-mesh

seems like it has to do with reading asset data that isn't immediately available in editor for some reason.

image

@Doprez
Copy link
Contributor

Doprez commented Jun 29, 2024

I did a quick test to make sure it wasn't just working for procedural meshes:
image

The only quirk that I can see now is you have to move the physics collider to update the debug mesh the first time.

@YerkoAndrei
Copy link
Contributor Author

its not working on my machine, i tried that 2 weeks ago and it didnt work :(
ill try a project from zero

@Doprez
Copy link
Contributor

Doprez commented Jun 29, 2024

I did some more messing around and a new issue now is the editor full crashes when more than one static mesh is added to the collider shapes.

@Doprez
Copy link
Contributor

Doprez commented Jun 29, 2024

So, something thats odd but seems to work is if you create your physics meshes while the navigation stuff is deleted it seems to be fine.

the crash seems to be the fault of NavigationMeshBuilder line 479 when its expecting an updated component that may be out of date or too early? looking into that now.

@Doprez
Copy link
Contributor

Doprez commented Jun 30, 2024

Wait.... even in 4.2.0.2188 I can get the static meshes to work. As long as I don't use a procedural mesh at least.

image

The current issues seem to be related to using procedural meshes as the static mesh or trying to create a compound mesh for the static mesh.

Another important thing to note is that there is a bit of lag with how meshes are updated due to transforms being updated after the mesh is built

The PR I have at least fixes the procedural mesh issue but I am struggling to find the solution for compound meshes, it goes pretty deep.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants