So i have a “lava” tile and i’d like to add “heat” around it, but as a tile, i’m not sure what’s the best way, i have 2 ideas:
Make the player constantly raycasts (but that would be pretty annoying because detecting a lava tile around the player would need raycasts in all directions or some kind of capsule raycast… not sure, and doing so in every update also sounds really cpu intensive…)
Maybe make a scriptable tile? i’ve read a bit but i’m not totally sure if that’s possible, maybe add a boxcollider for lava tiles in a script around the lava tile and on trigger enter/stay make the calculations over the player…
You shouldn’t need to do raycasts at all, that’s for sure. You can ask the grid which what tile position a vector3 is in using worldtocell, and then use that to figure out which tile is there or adjacent easy enough, and it isn’t that taxing on the cpu.
That said, you might try to use multiple tile layers and build your heat boundries on one of these, unseen as it is under the main tile layer. You can then make these broundries as tiles themselves in simple form and just give it a tilemap collider. I do something similar for my isotilemap to act as elevation colliders as they logically have to collide at the foot of the tiles rather than the full tile graphic. Nice thing about this method is in editor it is easy to temporarily turn off your graphic tilemap to easily overview the collider tilemap.
Mmm i like the idea, the problem is the “blocks” are generated randomly, but i can also add those “heat” blocks to the “heat” tilemap, or use the “worldtocell” solution (i’m familiar with it), but as the “heat” is around the tile/blocks, like 1 block around it, i’d have to check all sorrounding blocks around the player every single update which i don’t know if it would be hard for the cpu… 1 tile don’t think so, 9 tiles… dunno.
That’s why the “heat” tilemap could work, i’ll try that, thanks!