#Make navagents avoid tiles with collision on tile on layer 1 when a navigation tile is below it.

10 messages · Page 1 of 1 (latest)

misty sun
#

Hii I'm trying to get pathfinding working using a nav agent on a 2d tilemap. What I'm trying to do is get the nav agent to avoid tiles that have collision tiles on layer 1 whilst having navigation tiles underneath it on layer 0 of the tilemap. Is that possible?

misty sun
#

anyone??

ripe kettle
#

Hi there 😊,

I think a bit more context would be helpful, since Physics, Tile maps & Navigation all have layers and masks it's (at least to me) unclear what should interact with what.

Also, I encourage you to describe the game feature in game not only engine terms. So, what needs to be happening to the player to make the desired effect/feature work.

misty sun
# ripe kettle Hi there 😊, I think a bit more context would be helpful, since Physics, Tile m...

Well currently I have a tilemap with a character on it. I want to then be able to move the character when I click on another position on the tilemap but it needs to also avoid any tiles that have no navigation layers assigned to them. The issue is that if I have a tile on layer 0 with a navigation layer and a tile on layer 1 with no navigation layer but a collision layer, the nav agent still wants to pass through. For now I just set the tile on layer 0 as an alternate tile with no navigation layer and that seems to work.

For some context, I want to have a character that occupies a number of tiles. So in order to do that I'm going to place a tile with no nav layer wherever the character is. Tbh there's a few more problems since I need to ensure that when the character moves it only is able to move where it can fit (i.e. there is enough tiles throughout the path to accommodate all the occupying tiles) which I'm not sure how to do. I also need to convert the pathfinding info from the nav agent into a path along the tilemap (i.e. an array of cell positions the character needs to move across within the tilemap rather than just in global space). Hope this gives better insight into the problem!

ripe kettle
#

Alright, is there a reason the navigation layer and the collision objects need to be separated? Or is it just additional collider objects are on another layer?

misty sun
misty sun
#

Aren't those used by nav regions? I'm still pretty new to navigation within godot btw

ripe kettle
#

There are some examples in the docs:

https://docs.godotengine.org/en/stable/tutorials/navigation/navigation_using_navigationmeshes.html

I'm not experienced enough with multi-layer tile maps to state if the described process from the docs is the only way to do navigationmap updates, but I think it's the way to go.

It's a bit to read up on, but it's well written, with examples, so worth it.