2D Toolkit Forum

2D Toolkit => Support => Topic started by: Brandon on October 26, 2013, 12:54:31 am

Title: Collision detection on different layers
Post by: Brandon on October 26, 2013, 12:54:31 am
Alright so I have a tilemap with different layers. My walls of my top-down game are the first layer (z = 0). The floor tiles are what the player can step on without having a collision (z = -2) and now i want to add a floor tile which will trigger an action. I put that on a trigger layer (z = -1). My player is a z = 0. How can i do a collision between a floor tile at z = -1 when my player is at 0? I tried putting the tiles at the same z layer but my player will occasionally disappear underneath.

Thanks in advance :D
Title: Re: Collision detection on different layers
Post by: unikronsoftware on October 26, 2013, 05:44:39 pm
You can make the collider a lot deeper if needed if it can't physically touch another layer? If you need triggers one option is to add data prefabs - spawn them as a tile with a box collider trigger and use it that way.
Title: Re: Collision detection on different layers
Post by: Brandon on October 26, 2013, 06:09:55 pm
Oh I think I get what you mean.. Thanks for the tip  ;D