Tilemaps - Creating Depth Illusion

Hello everyone,

Currently I am building a top-down shooter game using tilemaps, and here is how it looks like right now:

7380584--900506--old.png

Now my problem is I want to have some “depth” feeling to the walls, because technically those walls have height. Here are some screenshots from, one of my favorite games, Nuclear Throne as inspiration:

As you can see, the “bottom” tile have some overhang, where you can’t go through it, and the “top” tile also have some overhang where you can go through it, creating an illusion of walls with height.

I thought I could achieve this by making longer tiles (64x96) and move their pivot around, and this is what they looked like in the tile palette (the bright yellow ones):

The issue is when I painted with them, the Tilemap Collider actually picked up on the extensions, and blocked me from moving into it, so I couldn’t really move “into” the wall from the top side:

7380584--900518--long_tile_problem.png

I can think of a couple solutions:

  1. I can make two layers where one is the wall with the tilemap collider, where only the “bottom” overhang will be present (and hence will have the Tilemap collider), and then have another layer that only paints the “top” overhangs with no collider so that the player can go through it. I think this is kind of a band-aid solution and can cause some problems down the road (what if I have a rule tile of sorts and I want them to be all connected for a pattern?)

  2. have a separate “overhang” game object just with a sprite renderer, and instantiate a bunch on top of the wall tiles that should have the overhang? (I think this is also a silly solution…)

I guess what I am trying to ask it, has anyone tackled this issue before and could find a satisfactory solution? Thanks in advanced for the help!

uhm, currently dont have unity open, but in the sprite editor window, you can simply draw the sprite collider

in other words, the collider your tilemap uses for the composed collider does not need to lign up with the sprite itself (tho I think it cant be larger then the quad the sprite is drawn on)

however if you want your wall collider to be exactly 1 tilemap-unit² in size, there is also an option in the unity tile asset, where you set the collider type (None, Tile, SpriteCollider), you could also just set that to Tile
(dont have unity open, not entirely sure if its called ‘Tile’ or something else)

1 Like

Looks like you are correct!

7380887--900560--upload_2021-8-1_22-59-41.png

For anyone else that is curious, go to the “Tile” file and in there select “Grid” instead of “Sprite” for the Collider Type.

7380887--900563--upload_2021-8-1_23-0-19.png

1 Like