One-way collision platforms with Paper2D tile-maps?

So you know how in some side-scrolling games you can jump through the bottom of a platform and land on the top of it? I’m trying to figure out how to accomplish this with tile-maps. The common method I’ve heard is to have a trigger under the platform so that when it’s overlapping with the player it disables the platform’s collision, and when not overlapping with the trigger, the platform’s collision is enabled.

The issue with this is that I have no idea if this is actually possible using tile maps. Can I have different layers have different collision settings? Then how would I even dynamically alter that layer’s specific collision with blueprint?
Any ideas? Thanks.

1 Like

I did this with relative ease by putting my one-way platforms on a separate tile-map as I think there currently is a bug with having different physics settings on different layers within a tile-map. So start with placing the platforms you want to jump through on a separate map, then on that map adjust the physics settings to the following.

So create a new Physics Object like so:

Setup the tilemap that has your platforms on:
Platform Physics.PNG

My character also has block all on everything:
Platform Physics.PNG

Now I change the collision from block to overlap when my character jumps using the Event On Jumped, as you can see the channel is set to platforms so everything using the physics object “Platforms” will now let things pass through and generate an Overlap event. The capsule component is the characters own collider.
Character Physics.PNG

I do a check to see if my character is falling and if he is I change collision on the channel to block. You can see I’m doing a check too see if I’m currently passing through a platform as without it I was getting stuck halfway through, the check is below.

Just a simple bool set on overlap events.

Not sure if this is the best way but I didn’t want to create triggers under every platform by hand and the result is something like the following. Any issue’s let me know.
Platforms.gif

2 Likes

Okay, that sounds reasonable. I can foresee the double tilemap workaround possibly becoming an issue when you need to do some possible major changes to your level but I think I would be able to handle it. Thanks for the input!

I went ahead and tried your method but my platforms are going to behave a little differently. The way mine are set up allow you to be able to walk in front of them before being able to jump on top of them (think the terrain in Super Mario World.) Here’s what it looks like right now: https://dl.dropboxusercontent.com/u/3489564/ShareX/2016/02/2016-02-20_18-12-40.webm

How do you suggest I handle the collision here?

Edit: Nevermind, it was really simple. I just have a trigger actor under the platform that checks when overlapping, and sets the platform to ignore collision and then sets it to block when not overlapping. Thanks for your help!

Edit 2: WAIT NEVERMIND AGAIN. I just realized this won’t work if I want to have stacked platforms that you can jump through. Ah man, I’m stuck again.

Yeah I’m hoping that not being able to set physics for each layer in a tilemap is a bug and this will be fixed. I didn’t really account for stacked platforms I’ll test some things and see if I can get it working and get back to you. I’d say maybe triggers covering each platform if the player is higher than the trigger then enable collision, but it would require you having an array of every trigger in the level. Might be one way todo it.

Oh dude that’s a great idea! I actually got it working. It’s a little cumbersome level-design wise but it works pretty solid. I made a trigger actor that compares the height of the player to itself, and when the player is higher than the trigger it will set itself to block. Thanks for your help!

So perhaps a bit of a necro post, but I had to embellish a bit on this concept. For me it didn’t quite work withtout taking the capsule height and height of the platform into account:

Thank you for sharing your solution. That is exactly what I needed.

Still a bit new to all this… but would this solution work for multiple players and creatures that can jump through platforms, or would anyone jumping trigger the overlap/block check?