From 026471784ea5961d9631a673d863c27f85de77a2 Mon Sep 17 00:00:00 2001 From: Hugo Locurcio Date: Tue, 16 Sep 2025 16:19:24 +0200 Subject: [PATCH] Document `TileMapLayer.get_coords_for_body_rid()` precision depending on quadrant size --- doc/classes/TileMapLayer.xml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/doc/classes/TileMapLayer.xml b/doc/classes/TileMapLayer.xml index fb9ec98cee2..2e3913be58f 100644 --- a/doc/classes/TileMapLayer.xml +++ b/doc/classes/TileMapLayer.xml @@ -116,6 +116,7 @@ Returns the coordinates of the physics quadrant (see [member physics_quadrant_size]) for given physics body [RID]. Such an [RID] can be retrieved from [method KinematicCollision2D.get_collider_rid], when colliding with a tile. + [b]Note:[/b] Higher values of [member physics_quadrant_size] will make this function less precise. To get the exact cell coordinates, you need to set [member physics_quadrant_size] to [code]1[/code], which disables physics chunking. @@ -314,7 +315,7 @@ The [TileMapLayer]'s physics quadrant size. Within a physics quadrant, cells with similar physics properties are grouped together and their collision shapes get merged. [member physics_quadrant_size] defines the length of a square's side, in the map's coordinate system, that forms the quadrant. Thus, the default quadrant size groups together [code]16 * 16 = 256[/code] tiles. [b]Note:[/b] As quadrants are created according to the map's coordinate system, the quadrant's "square shape" might not look like square in the [TileMapLayer]'s local coordinate system. - [b]Note:[/b] This impacts the value returned by [method get_coords_for_body_rid]. + [b]Note:[/b] This impacts the value returned by [method get_coords_for_body_rid]. Higher values will make that function less precise. To get the exact cell coordinates, you need to set [member physics_quadrant_size] to [code]1[/code], which disables physics chunking. The [TileMapLayer]'s rendering quadrant size. A quadrant is a group of tiles to be drawn together on a single canvas item, for optimization purposes. [member rendering_quadrant_size] defines the length of a square's side, in the map's coordinate system, that forms the quadrant. Thus, the default quadrant size groups together [code]16 * 16 = 256[/code] tiles.