You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Windows 10 - Intel(R) Core(TM) i5-5200U CPU @ 2.20GHz 2.20 GHz
Issue description
When checking if in bounds for a tile it does not take into account the offset property. I have to subtract my cell id by the offset inside of the is_in_bounds() command.
Steps to reproduce
create a new project
create a Node2D
attack script to Node2D
paste following into script:
extends Node2D
var astar_grid:AStarGrid2D
func _ready():
_init_grid()
print(astar_grid.is_in_bounds(10,10)) #should be out of bound
print(astar_grid.is_in_bounds(125,125)) #should be in bounds
func _init_grid() -> void:
astar_grid = AStarGrid2D.new()
astar_grid.size = Vector2i(100,100)
astar_grid.offset = Vector2i(50,50)
astar_grid.cell_size = Vector2(16,16)
astar_grid.update()
This is not what this property is for, see the documentation, the is_in_bounds check works for grid points, not the resulting output points. There's a translation of sorts from the grid points to the output points, controlled by offset and cell_size
I.e.
The is_in_bounds method is controlled by region, and that is then translated into the output data
This should be documented more clearly on is_in_bounds though, will look at some improvements
Godot version
v4.1.1.stable.official [bd6af8e]
System information
Windows 10 - Intel(R) Core(TM) i5-5200U CPU @ 2.20GHz 2.20 GHz
Issue description
When checking if in bounds for a tile it does not take into account the offset property. I have to subtract my cell id by the offset inside of the
is_in_bounds()
command.Steps to reproduce
paste following into script:
Minimal reproduction project
New Game Project.zip
The text was updated successfully, but these errors were encountered: