Jump to content

Issue with circle hitbox and physics group


1nspect0r
 Share

Recommended Posts

Hello

So,  got an issue driving me nuts. Trying to enable collision between balls, I wanted to make a body group but issue popped out, balls want to slide on the others, it's kinda random, sometimes it bounces as expected, sometimes not. 

It seems related to the shape because without the circle hitbox collisions are okay. But it was working without the group so...

  var balls = this.physics.add.group();

  balls.create(100, 250, 'blueBall').setDrag(0.975).setDamping(true).setBounce(1).setCollideWorldBounds(true).setCircle(200).setScale(.2).setInteractive();
  balls.create(200, 350, 'redBall').setDrag(0.975).setDamping(true).setBounce(1).setCollideWorldBounds(true).setCircle(200).setScale(.2).setInteractive();
  balls.create(100, 350, 'redBall').setDrag(0.975).setDamping(true).setBounce(1).setCollideWorldBounds(true).setCircle(200).setScale(.2).setInteractive();

  this.physics.add.collider(balls);

I had no issue at first without making the group, collision where perfect between two balls using this snippet : 

ball = this.physics.add.image(100, 250, 'blueBall');
ball.setDrag(0.975).setDamping(true).setBounce(1).setCollideWorldBounds(true).setCircle(200).setScale(.2).setInteractive();

ball2 = this.physics.add.image(160, 250, 'redBall');
ball2.setDrag(0.975).setDamping(true).setBounce(1).setCollideWorldBounds(true).setCircle(200).setScale(.2).setInteractive();

this.physics.add.collider(ball, ball2);

If you have any ideas at this point...

captured.gif

Edited by 1nspect0r
Link to comment
Share on other sites

  • 2 weeks later...
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...