p2.js icon indicating copy to clipboard operation
p2.js copied to clipboard

[bug]Some concave shapes will fall into other when fall down.

Open guawoo opened this issue 6 years ago • 4 comments

bug

This is werid case, I have no idea to deal it.

guawoo avatar May 22 '18 03:05 guawoo

Hi @guawoo.

Have you tried using the Body parameter ccdSpeedThreshold?

It's default value is -1, and it is disabled by default. If you need high resolution impacts, because objects are moving very fast, set it to 0 in your Body constructor, and that should fix the problem.

const body = new Body({
  ...,
  ccdSpeedThreshold: 0,
  ...
});

Note, you may have to use the github version of p2.js by installing it via npm using:

npm install --save schteppe/p2.js

jtenner avatar May 22 '18 15:05 jtenner

@jtenner Thank you so much, I have to set ccSpeedTreshold to 0 and use github version,but this case still appear. It is not normal appearance, need to special shapes and special positions like gif in. :(

guawoo avatar May 23 '18 02:05 guawoo

Can you please replicate the problem with an online environment like codepen?

jtenner avatar May 29 '18 18:05 jtenner

This bug is probably fixed after adding polygon clipping. Could you try getting the latest master branch, rebuilding the library and see if it works better? Thanks.

schteppe avatar Jun 24 '18 17:06 schteppe