Help with 2D Top Down Shooter

Hi,

I am currently working on a 2D Top Down shooter and I am having a problem with wall colliders.

I am using Tilemaps to create rooms and I have a collider Tilemap for the walls. Then, I have added a collider to the Feet of the player and it works fine. However, it is time to throw projectiles and I would want to use this same Wall Tilemap collider to destroy the projectiles, and I currently have an issue when the player is just below the top wall of the room. As you can see in the screenshot below, since the upper body of the player is on top of the wall, when I throw the projectile (bone) it is on top of the wall and it gets destroyed automatically.

Is there a way to implement this without having to add more complexity? Almost all 2D top down games have this issue solved, so I suspect there is an easy way to solve it without having to add more collider layers.

Thank you very much!

Albert

Since Queries Start in Colliders doesn’t work for tilemaps, the only option I can think of is doing two walls, most games must do this, since usually the bullets never hit the base of the wall, they usually are destroyed around the middle, to simulate depth.

Thanks for your answer!!

And then, I would have to do the same for all other objects in the scene? Having one collider for the feet of the characters, and one for the projectiles, right?

Exactly, there’s not major overhead, just some inconvenience, which can be reduced by using prefabs. Make sure to adjust the layer matrix accordingly, so that the bullet does not collide with the PlayerWall.

just a tip, you might also want to add a composite collider 2d to your tilemap, from your screenshot, doesnt look like you have one.

1 Like

Thank you for solving my problem and for the extra tip! :slight_smile: