Change physics body collider

I want change physics body collider size and angle.

Currently i developing Bubble shooter game using Phaser 3, but i think it’s not fit (difficult to play) if using box collider, i already change to circle collider ( obj.setCircle(…) ), but the performance are poor.

sfsdf

I have an idea to resize it’s collider size to 70% of it’s sprite size, and rotate it 45 degree.

But i don’t know how to do this with Phaser 3.

Any help ?

Hey William,
You can change the size of the collider by using: mySprite.body.setSize(width, height).

Unfortunately with the Arcade Physics, you cannot change the angle yet. I’m surprised to hear that setting the colliders to circles hurt your performance. It shouldn’t be too processor intensive.


Did some benchmarking. It looks like the circle colliders do take up significanly more processing power if you have debug enabled. This makes sense as the draw calls would be much more intensive than drawing a square. @William_Soeparjo, I would suggest using circle colliders, because when your game is released, you won’t have debug enabled.

4 Likes

Hi

Thanks for your reply!

I just use Circle collider instead, now it’s don’t have a performance problem, even debug are enabled.

I don’t know why, but it’s good