-
-
Notifications
You must be signed in to change notification settings - Fork 21.4k
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
Hexagon Tileset 2D don't use regular hexagon #92338
Comments
Just for visibility, need to verify it would not impact 3D version (like grid visualisation etc) |
This is something to document as a first step, we can't change the tile shape directly Adding a regular hexagon tile would be something for a proposal IMO But are you sure you can't achieve this by just adjusting your tile size? |
Would be great for documentation as first step indeed. But handling irregular hexagon not means that distance calculation would be biaised ? Since we use tile_size for positions when creating after that AStar or whatever grid pathfinding algorithm we use. Also it's a pain to fix it exactly to the size of the regular one, since we make those tiles with a tile_size in mind (like 64x64 or other size), tweaking it with a 13.6 pixel separation not scale. |
Hello, func astar_add_walkable_cells():
var points_array = []
for point in get_used_cells(0):
var position_cell = to_global(map_to_local(point))
...
astar_node.add_point(point_index, position_cell, tile_data.get_custom_data("Cost"))
return points_array And debug it back... (pink global distance, red cost) In this video 115 * 1 + 115 * 10 < 128 * 10 so it doesn't takes the shortest path. I was preparing a public template for hexagon map so feel free to test it on my code |
Have made a demo project, could be used to experiment |
Tested versions
System information
Godot v4.2.2.stable - Windows 10.0.22631 - Vulkan (Forward+) - dedicated NVIDIA GeForce RTX 3060 Ti (NVIDIA; 32.0.15.5585) - 11th Gen Intel(R) Core(TM) i7-11700KF @ 3.60GHz (16 Threads)
Issue description
Seems all the grid with hexagon are not regular ones mathematically, since the outline touch the border on two faces.
To illustrate, the difference beetween this one (regular)
and this one (not regular)
is subtle, but that means distance on extremity are not the same on the second case (and could lead to wrong AStar ?)
Inside Godot TileSet, we use not regular one :
Steps to reproduce
Minimal reproduction project (MRP)
Chara_TopDown_Hexagon.zip
The text was updated successfully, but these errors were encountered: