p2.js
p2.js copied to clipboard
Overlapping after fall (video)
I can provide code too if it will be necessary
How to decrease overlapping after fall down on static body? It looks very strange..
Circle body falls down and when it reachs ground (static box body) then it falls down a little.. more over static body, next step, it goes up to line of ground. Very visible.
VIDEO: https://webmshare.com/b8Wxy
this.world = new p2.World({ gravity:[0, 9.5] });
this.world.solver.iterations = 10; //more or less, not fixing problem
this.world.solver.tolerance = 0; //same here
World.prototype.update = function() { // called 60 times per sec
this.world.step( 1/60 );
}
High speed objects need CCD. Otherwise the object will be pushed into other objects and overlap.
but with CCD it still happens only a little less often.
Does CCD is created only for very small bodies aka bullets?
Does algorithm that works for any size of body exists?
CCD can be enabled manually on bodies. Size does not matter. Not sure if it will help here.
I wrote a parameter tweaking guide for Cannon.js that should work for p2 as well. It should help minimizing the overlap. Read it here https://github.com/schteppe/cannon.js/wiki/Parameter-tweaking