The bug is visible in the first image where the 2 boxes are 45º degree and are sliding on the lattice, obviously not very realistic. In the second image you can see that one box is sliding correctly.
var canvas = $('<canvas id="display" width="1280" height="450"></canvas>')
this.$el.append(canvas)
var renderer = Newton.GLRenderer(canvas[0]),
sim = Newton.Simulator(undefined, renderer.callback, 60, 10),
gravity = Newton.LinearGravity(0, 0.002, 0),
container = Newton.BoxConstraint(0, 0, 1280, 450),
squishy = Newton.Squishy(525, 250, 70, 16),
boxes = createBoxes(20, 20, 25, 10),
fabric = Newton.Fabric(700, 0, 1250, 50, 40, 22),
lattice = Newton.Lattice(0, 200, 50, 10, true, true),
anchor = squishy.particles[0];
anchor.pin(525, 0);
sim
.add(gravity)
// .add(squishy, 'squishy')
.add(boxes, 'boxes')
// .add(fabric, 'fabric')
.add(lattice, 'boxes')
.add(container)
// .link('squishy', 'boxes fabric')
// .link('boxes', 'boxes squishy fabric')
// .link('fabric', 'boxes squishy')
.start();
$('#display').on('mousemove', function(e) {
var offset = $(this).offset();
var x = e.pageX - offset.left;
var y = e.pageY - offset.top;
anchor.pin(x, y);
});
function createBoxes(x, y, size, amount) {
var boxes = [];
while (amount--) {
boxes.push(Newton.Box(x + amount * size * 3, y, size));
}
return boxes;
}