schteppe / p2.js

JavaScript 2D physics library
Other
2.64k stars 329 forks source link

can not eliminate the elastic force? #145

Closed snowhan closed 9 years ago

snowhan commented 9 years ago

Hi, there

I created two rigid bodies using p2.js when coding a game. The requirement is no elastic force or any depressions existed when impacting which means the rigidity is infinite.

However, it turns out poor even when I set the parameters of options to restitution:0.0, stiffness : Number.MAX_VALUE.

I wonder to ask how to eliminate the elastic force of each other completely?

Thanks.

schteppe commented 9 years ago

Hello,

It is not possible to remove it completely, but you can reduce it. Try one or several of these options :

  1. Use a smaller time step.
  2. Make sure the impact velocity and overlap is small.
  3. Try different ContactMaterial properties, like .stiffness and .relaxation

It's easy to test these things in my demo renderer. See any of the p2 demos.

Good luck!