1nspect0r

Issue with circle hitbox and physics group

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

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...

  • Recently Browsing   0 members

    No registered users viewing this page.