Taking the the result of `get_used_rect()` from an Isometric `TileMap and converting it to cartesian coordinate system

:information_source: Attention Topic was automatically imported from the old Question2Answer platform.
:bust_in_silhouette: Asked By ugly_cat

The problem

Hey everyone, I posted a similar question, but I wasn’t specific about the kind of TileMap I was using. Basically I want to transform the result of get_used_rect() into a result I can use to stretch a TextureRect over the entirety of my TileMap.

I’ve been learning about matrix transformations in order to solve this problem, but It’d be nice if anyone can give a solution.

Context

I’m trying to create a fog of war shader. I have almost everything figured out, but I can’t get the TextureRect (which is rendering the shader) to stretch accross my isometric TileMap. Does this sound like the right approach? I’ll post a repo of the project soon.

Edit: link to the repo

Edit 2: figured out how to the get the correct size. I erroneously thought that the size of the TextureRect should be multiplied by the cell_size, not the case. The actual number to multiply the TextureRect before the transform is made is by what the tile size side would be if you made the inverse transform on it (basically flattening it). In the demo that number is something like Vector2(90, 90).

I think got the hang of Transform2D, now I just need to get the TextureRect in the right position…

ugly_cat | 2019-02-07 03:30