Gerrudo / reticulating-splines

An isometric city building game.
0 stars 0 forks source link

Buildings being placed on water on end of x axis #40

Closed Gerrudo closed 1 month ago

Gerrudo commented 1 month ago

Buildings are being placed 1 tile off the x axis on our terrain.

Found issue in .HasTile in PlacementAllowed()

Gerrudo commented 1 month ago

Found solution here: https://stackoverflow.com/a/61199280

Unity is applying a 1 tile offset on the x and y axis when we're checking our terrain tile map.

I'm unsure if this is due to the size of tile, sorting layer or just a bug introduced by casting our mouse position to a Vector2. But bool hasBuildingTile = defaultMap.HasTile(currentGridPosition - new Vector3Int(1, 1, 0)); seems to fix the issue for now.