Is there a way to find an individual tile's coordinates in Godot 4.5?

Godot Version

4.5.1

Question

My game utilizes custom tile data to achieve breakable terrain. The beginning of the check between the player’s attack hitbox and the destructible tilemap is as shown here:

When updating Godot to 4.5.1, this feature no longer worked, and I noticed that the description for get_coords_for_body_rid (which I used find out which tile the player was hitting so I could determine both which tile should be broken and in what way it should be broken) had been changed:

It no longer provides the coordinates of an individual cell, but instead returns the coordinates of what I assume is a single collision shape made by combining several tiles (I recall reading something about this before and how it would optimize TileMapLayer performance?)

Unfortunately, after scouring the 4.5 docs I can’t really see any way to which exact tile the player is attempting to hit anymore? get_coords_for_body_rid doesn’t even seem to return a position within the physics quadrant so it seems like a dead end for that. Am I missing something or is this just not possible anymore?

edit: converted previous edit to separate post

3 Likes

I’d recommend putting your solution in a reply to your original post and marking it as the solution. It’ll be clearer to people looking for a solution in the future.

Yeah, that sounds good.

Simplest way to do this, if you’re not concerned about the performance impact, is to go to the Physics tab on the TileMapLayer and set the Physics Quadrant Size to 1.

2 Likes

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.