Arcade physics jump-through platforms glitch

I am trying to get jump-through platforms to work, and work well, using arcade physics.

tile.setCollision(false, false, true, false) does most of the work.

However I am finding if the player’s body overlaps the top of the tile by around 50%, the sprite is pushed to the top of the tile instead of passing through it (see the jump in the gif).

ezgif-7-76dfb5216f75

I would like player to only land on the tile if it’s body if fully above the tile.

Has anyone come across this before? Know a fix / workaround? Perhaps impact physics is a better option?

Thank you

Just a suggestion.
What if you check the collision only while the velocity is downward?

Thanks for the suggestion @Thyebe, but I reckon the player will still pop to the top of the tile the moment you start moving downwards. I might try only checking the collision when the y position of the player is less than the tile, but that feels like a hack. I assumed there’d be a more natural way of implementing jump-through tiles with arcade physics :pensive:.

1 Like

Try decreasing TILE_BIAS.

Ok. I think I need to learn more about TILES.

Thanks @samme. I have had a play with the TILE_BIAS. When setting it low (<= 8) the player passes through platforms when falling from a great height. There is a trade off. But 12 seems to suit my needs.

Issue fixed with:

this.physics.world.TILE_BIAS = 12;

You may be able to reduce body.maxVelocity.y as well to avoid that.

Okay I’ll bear that in mind, thanks @samme.