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

Pathfinder and 2D isometric tilemaps dont find path between side cells #43079

Closed
schweigert opened this issue Oct 25, 2020 · 11 comments
Closed

Comments

@schweigert
Copy link
Contributor

schweigert commented Oct 25, 2020

Godot version: 3.2.2.stable

OS/device including version: Manjaro / Nvidia Rtx 3090 / Core I9 / 64GB

Issue description:

I am configuring the Navigation2D node in my project, which is using a TileMap node configured for isometric visualization. When debugging, I realized that it only generates its way on the tile where it is already positioned, never to other places.

I've tried to increase the size of the navigation borders in the tilemaps editor, but it just doesn't work.
I tried to make the mesh match perfectly, and it didn't work.

Steps to reproduce:

Create a Navigation2D node and add a TileMap as a child.
Configure the tilemap through the TileMap editor.
Debug with a Line2D the path generated by Navigation2D

Peek 25-10-2020 14-25

image

image

extends Line2D

onready var nav : Navigation2D = get_parent() as Navigation2D
onready var player : Node2D = get_parent().get_node("Player") as Node2D
func _ready():
	InputBehavior.connect("clicked", self, "_input_clicked")

func _input_clicked(position : Vector2) -> void:
	points = nav.get_simple_path(nav.get_closest_point(player.get_global_transform().get_origin()), nav.get_closest_point(position))
extends Camera2D


func _input(event):
	if event is InputEventMouseButton and not event.pressed:
		InputBehavior.clicked(get_global_mouse_position())
@erictuvesson
Copy link
Contributor

@schweigert Do you have any custom properties on the tiles?

It seems like you have the navigation debug on in the screenshot, hard to see when it's so green.

I tested navigation with a isometric tilemap and I had no issues.

@schweigert
Copy link
Contributor Author

No, I didn't add any attributes to the tile @erictuvesson .

image

I found it strange because in other examples I saw, navigation appears united in debugging. In my case, it displays several separate blocks, and I cannot understand why it is not merging the navigations.

@erictuvesson
Copy link
Contributor

Can you share the project? I am not sure how you are making the tiles offset as there are multiple ways.

@schweigert
Copy link
Contributor Author

Unfortunately not because it is a commercial project.

I managed to make it work, but it really needs to be pixel perfect between the tiles' polygons, which when we have several tiles in separate sprites is difficult to test.

Peek 28-10-2020 09-04

I found it strange that if two mesh polygons are overlapping, it does not mix both to create a unique navmesh. Perhaps it is a possible improvement in this system. What do you think?

@Zireael07
Copy link
Contributor

If it's an issue of polygons having to be pixel perfect, it's an already reported issue that applies to both 2D and 3D navmesh/navpoly.

Yes, merging overlapping polys would be an obvious improvement, but no one did it in at least a year that passed since I last saw the issue reported.

@Zireael07
Copy link
Contributor

Zireael07 commented Oct 28, 2020

I found the issues: #12275, #17118 and a duplicate was closed as fixed with the 4.0 navigation server feature (but it's still an issue in 3.x)

So they're waaay older than I thought, explains why I couldn't find them when writing the previous comment.

@CyberFoxar
Copy link

I had the same issue with hexagonal tiles. Overlapping the meshes does not work on 3.x .

@Calinou
Copy link
Member

Calinou commented Dec 30, 2020

@CyberFoxar Please upload a minimal reproduction project to make this easier to troubleshoot.

@CyberFoxar
Copy link

CyberFoxar commented Dec 30, 2020

Sure, here's the simplest example I have. Recommended to tick debug>"View Navigation" to see overlapping tiles.
The line shows the plotted path (or lack thereof). You can see that the path can be plotted from one tile to the next (x axis) because there's no overlap between polygons. However, when trying to got down (y axis) get_simple_path just does not work, because there's overlapping navigation polygons.

MinimalBroken.zip

Edit: Made with Godot 3.2.3

@Calinou
Copy link
Member

Calinou commented Jan 5, 2021

@schweigert Did you find a solution to this issue? If not, I recommend leaving the issue open.

@CyberFoxar
Copy link

Either that, or I'll repost mine on its own issue.

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

No branches or pull requests

6 participants