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

Half of Tilemap baked perfectly #122

Open
CMorooney opened this issue Feb 10, 2023 · 7 comments
Open

Half of Tilemap baked perfectly #122

CMorooney opened this issue Feb 10, 2023 · 7 comments

Comments

@CMorooney
Copy link

I have 3 tile maps with NavMeshModifiers

the tilemaps under the Walkable are..well, walkable. And the others are not. You can see at the top half of the map the intention of the layers as the tool works beautifully.

Screenshot 2023-02-10 at 6 52 51 PM

but I cannot for the life of me figure out why it's not all correct. I do notice some edges are white (instead of black) in the navmesh gizmo over the problem area, though that's not the only instance of that. Has anyone seen this? My Nav Mesh Surface GameObject just has NavMesh CollectSources2d and NavMeshSurface components with default settings, rotated.

@h8man
Copy link
Owner

h8man commented Feb 11, 2023

Make sure that you don't have Unity Navigation.AI package, as we have name collisions
Disable tilemaps one by one for trouble shooting.

@CMorooney
Copy link
Author

I eventually figured out that my object with the NavMeshSurface component had an ever so slightly different X rotation than the tilemaps somehow -- setting each to be rotated 90deg manually solved my issue.

looking back at the problem with that in mind, it makes sense. So I'm closing this -- thanks for your response and your library!

@h8man
Copy link
Owner

h8man commented Feb 12, 2023

Hmmmm. Its intentionally 89.98, as this rotation fixes Agent navigation on straight pass on Y.
Can you share more details? maybe I should switch back to 90

@CMorooney
Copy link
Author

CMorooney commented Feb 12, 2023

maybe I set something up wrong with my tilemaps in relation to that object and it's 89.98 XRot offset...

but I have tried the following and none have gotten the desired result in the same way that switching that offset to a 90 has:

  • making the tilemaps children of the NavMeshSurface/Collect Sources game object

    • This auto-sets the tilemap's XRotation to 90 and when baking none of the NavMeshSources get used
    • Tried adjusting the tilemap offset angle to match the parent object and I get the "half-bake" result
  • making the tilemaps a sibling of the NavMeshSurface/CollectSources game object

    • Tilemaps XRotation is defaulted to 0, I get "half-bake"
    • Tried adjust the tilemap offset to be complimentary to the NavMesh object (setting it to +-89.98 basically make it invisible so I was trying +-.02) and still got the "half-bake" result

I will have to look into the workaround that is odd offset exists for and see if it's occurring for me at 90deg.

So far the only configuration that has worked fully for me is making the Tilemaps container object a child of the NavMeshSurface/CollectSources object with the NavMeshSurface object XRot set to -90 and the Tilemaps container XRot set to 90.

I should note just in case that the tilemaps are generated from LDtk via LDtkToUnity

Unity 2021.3.17f1

@CMorooney CMorooney reopened this Feb 12, 2023
@CMorooney
Copy link
Author

this is a short/shitty gif of my agents running around (bottom left corner) -- this is with the hard 90deg XRotation (and the
correct nav mesh I would expect with my tileset)

From what I understand that slight .02 offset was to solve stuck agents moving in the Y direction? I see a few of these guys going directly up crosswalks no problem, but it's possible I misunderstood that problem

desktop-front-idle

h8man pushed a commit that referenced this issue Mar 20, 2023
@h8man
Copy link
Owner

h8man commented Mar 20, 2023

Can you send minimal test project for troubleshooting?

@CMorooney
Copy link
Author

CMorooney commented May 1, 2023

Can you send minimal test project for troubleshooting?

sorry for the late response...I've somewhat moved on for now onto other projects. Unfortunately I don't have a minimal repo but this is the project I was working on when coming across this problem

https://github.com/CMorooney/CannibalRunUnity

(edit: quote formatting)

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

No branches or pull requests

2 participants