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

Friction and recovery bug

Open DavidHome opened this issue 6 years ago • 3 comments

bounce.txt change “bounce.txt” to “bounce.html”。s

When the cube falls, wait for a moment. You will find the cube above slowly moving away. This is a bug. How can I not let him fall? And how can it not rebound. I tried to use lockconstriaint. But slowly moving will not stack together. In friction: 1.0, restitution: 0.0. Isn't that a situation that shouldn't bounce and move? Thank you for helping me!

DavidHome avatar Jun 04 '18 10:06 DavidHome

Let the objects go to sleep...

world.allowSleep = true;

and

const body = new CANNON.Body(<CANNON.IBodyOptions>{ ... body.sleepSpeedLimit = 0.1; body.sleepTimeLimit = 3;

robrohan avatar Jun 06 '18 07:06 robrohan

bounce1.txt

mat1,mat4,still keep moving, it does not work me。can you give me a demo ?

DavidHome avatar Jun 08 '18 09:06 DavidHome

@DavidHome It looks like you've added sleep to the world (which is correct), but I think you need to add them to the bodies you want to let sleep too:

body.allowSleep = true
body.sleepSpeedLimit = 0.1;
body.sleepTimeLimit = 3;

robrohan avatar Jun 10 '18 06:06 robrohan