Phaser player fall through tilemap (tunneling) issue without continuous collision detection

When using Phaser with tilemaps, the player might fall through the map, which is the notorious tunneling (bullet-through-paper) problem. We can solve it by CCD (Continuous Collision Detection). However, I found out that in my case, if I change the tilemap to normal sprites, the issue disappears, so the issue must be related to the tilemap itself. After hours of search, I finally found the solution without CCD.

Changing this.game.physics.arcade.OVERLAP_BIAS has no use in my case. I need to set:

this.game.physics.arcade.TILE_BIAS = 64;

You can change 64 to a arbitrary large number. (Larger number may cause some other issues though)

Further Reading

  1. TilemapCollision: TILE_BIAS | Phaser Docs

Posted:

Comments