- Home /
How to make one-way platforms using a tilemap?
I would like my game to have platforms that don't affect the player from the bottom or the sides, only on the top. I would also like to be able to make these platforms using a tilemap. I think I should be using a Platform Effector 2D, but I'm not sure how to apply this to a tilemap. I have a Tilemap Collider 2D, which is used by a Composite Collider 2D, which is used by a Platform Effector 2D, but the tiles just behave like normal tiles.
Answer by firstlinestudio · Apr 07, 2018 at 04:49 AM
I think you simply need to remove the Composite Collider 2D and have your Tilemap Collider 2D use the Platform Effector 2D directly. You should also adjust your tile rules so that the collider type is changed from "sprite" to "none" for each tile you would like the player to ignore completely. You may be able to use the Platform Effector 2D through the Composite Collider 2D and just change the tile's collider state, but I have not tested that method yet.
I recommend creating separate Tilemaps for regular platforms and one-way platforms (if you don't already do this). These Tilemaps can be attached to the same grid.
This doesn't work for me because without composite collider I have many tiles, each of with it's own collision. As a result my character collides with the top and bottom of each of these tiles instead of just the top.
Answer by ShadyProductions · Mar 12, 2018 at 10:37 PM
Faces in collision meshes are one-sided. This means objects can pass through them from one direction, but collide with them from the other.
With a MeshCollider you can generate your own faces, there is a detailed explanation here: http://studentgamedev.blogspot.be/2013/08/VoxelTutP2.html
@ShadyProductions Your answer offers good insight, but I am not sure it applies to the question