Prevent objects from passing through walls

Hello there, I’m developing carrom board game using Arcade Physics. In which when I hit black or white rings of carrom using striker then ring passes through walls of carrom. How to prevent it from passing it through walls ?
Sorry for my bad English.

Thanks for reply. I tried it. but did not helped. I’m working on Phaser v2.9.2

Then you can try setting OVERLAP_BIAS higher than 4.
Or use P2, where you can set frameRate.

OVERLAP_BIAS did not worked. P2 does not have this kind of issue ?

Your pieces must be moving pretty fast then :slight_smile: What values did you try?

P2 has the exact same issue, every collision detection library has the same problem to solve.
But with P2 you can set the physics frameRate. If you double it, twice as many collision checks will be done.
Or you need an engine like Bullet (Ammo.js), that has CCD (continuous collision detection). CCD ensures that fast-moving bodies collide with objects instead of passing, or tunnelling, through those objects.

I used s.body.maxVelocity .setTo(150, 150);

Hmm, that shouldn’t be a problem. That gives a maximum of about 3.5 pixels when moving diagonally at 60 fps.

Did you try game.physics.arcade.OVERLAP_BIAS = 16; (or even higher?)

Yes, I tried it.

I’m out of suggestions. Maybe you could put some code online somewhere that shows the basic problem.

Or go for P2, and keep increasing the framerate until it works. But your speed should not be a problem…

Okay. Thanks for your support.