Branlin

Physics.ARCADE collision trouble. Sprite fall through the another sprite if hight velocity.

Recommended Posts

Example: https://jsbin.com/cakorijiqi/1/edit?js,output

Physics.ARCADE collision trouble. Sprite fall through the another sprite if hight velocity.

If you change the value from 500 to 100 in the velocity, then the problem does not occur.

this.boxGroup.setAll('body.velocity.y', 500);

What is the cause of the problem?

And I have noticed. If the swap these lines (#2, #3), the box to fall through the floor.

function update() {//#1
  game.physics.arcade.collide(this.boxGroup); //#2
  game.physics.arcade.collide(this.floor, this.boxGroup);//#3
}//#4

Sorry for my English. :)

Thanks.

Share this post


Link to post
Share on other sites

This is a consistent issue with Arcade Physics.
The reason why it happens is the sprite is moving fast and the checks happen based on FPS. So with a little division you will see that means there is space between collision detection for high speed sprites.

Only real way I know how to fix this is to look for the previousPosition and draw a line from that point to the current position, check if it collided and then move the sprite back.

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.