"Sometimes" collisions not working, can walk through the wall

Hi,
I have strange issue… I have a collision layer, everything working fine - my sprite can’t walk through, but sometimes I can “walk through” the collision layer event if it’s there… I’m sure collision map is correctly set and collision tile is there…

Can anyone help me with this?

Which physics engine? With Arcade you should be able to decrease timestep (increase simulation FPS). With matter, I’m not sure it’s implemented in Phaser (fixed timestep that is).

What you are experiencing is called tunneling and it happens when a body travels bigger distance than the obstacle’s size in single step. So decreasing step size fixes that.

I’m using just ARCADE physics, I just need simple collision for one sprite… just not to walk through the collision layer, nothing else

Try adding this.physics.world.setFPS(120); (or more) in create then. There’s also a config option fps in the Arcade config.
That will change the fixed timestep arcade will use, which will also change the simulation slightly.

2 Likes

You can also adjust tileBias (TILE_BIAS).

Verify the collision edges on the debug graphic.

This helps, thanks!

Also this help too… let there both :wink: