0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2024-12-24 13:29:01 -05:00

improved Example.newtonsCradle

This commit is contained in:
liabru 2021-12-29 23:08:46 +00:00
parent bf90bdd38c
commit b2bd492d05

View file

@ -99,7 +99,7 @@ Example.newtonsCradle.newtonsCradle = function(xx, yy, number, size, length) {
for (var i = 0; i < number; i++) { for (var i = 0; i < number; i++) {
var separation = 1.9, var separation = 1.9,
circle = Bodies.circle(xx + i * (size * separation), yy + length, size, circle = Bodies.circle(xx + i * (size * separation), yy + length, size,
{ inertia: Infinity, restitution: 1, friction: 0, frictionAir: 0.0001, slop: 1 }), { inertia: Infinity, restitution: 1, friction: 0, frictionAir: 0, slop: size * 0.02 }),
constraint = Constraint.create({ pointA: { x: xx + i * (size * separation), y: yy }, bodyB: circle }); constraint = Constraint.create({ pointA: { x: xx + i * (size * separation), y: yy }, bodyB: circle });
Composite.addBody(newtonsCradle, circle); Composite.addBody(newtonsCradle, circle);