schteppe / p2.js

JavaScript 2D physics library
Other
2.63k stars 330 forks source link

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

Open guawoo opened 6 years ago

guawoo commented 6 years ago

bug

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

jtenner commented 6 years ago

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
guawoo commented 6 years ago

@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. :(

jtenner commented 6 years ago

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

schteppe commented 6 years ago

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.