0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2024-11-27 09:50:52 -05:00

fix soft body stiffness

This commit is contained in:
liabru 2017-05-03 21:42:41 +01:00
parent e6babf04a8
commit 1bae2dee45
2 changed files with 3 additions and 2 deletions

View file

@ -34,7 +34,8 @@ Example.cloth = function() {
// add bodies // add bodies
var group = Body.nextGroup(true), var group = Body.nextGroup(true),
particleOptions = { friction: 0.00001, collisionFilter: { group: group }, render: { visible: false }}, particleOptions = { friction: 0.00001, collisionFilter: { group: group }, render: { visible: false }},
cloth = Composites.softBody(200, 200, 20, 12, 5, 5, false, 8, particleOptions); constraintOptions = { stiffness: 0.06 },
cloth = Composites.softBody(200, 200, 20, 12, 5, 5, false, 8, particleOptions, constraintOptions);
for (var i = 0; i < 20; i++) { for (var i = 0; i < 20; i++) {
cloth.bodies[i].isStatic = true; cloth.bodies[i].isStatic = true;

View file

@ -317,7 +317,7 @@ var Bodies = require('./Bodies');
*/ */
Composites.softBody = function(xx, yy, columns, rows, columnGap, rowGap, crossBrace, particleRadius, particleOptions, constraintOptions) { Composites.softBody = function(xx, yy, columns, rows, columnGap, rowGap, crossBrace, particleRadius, particleOptions, constraintOptions) {
particleOptions = Common.extend({ inertia: Infinity }, particleOptions); particleOptions = Common.extend({ inertia: Infinity }, particleOptions);
constraintOptions = Common.extend({ stiffness: 0.4 }, constraintOptions); constraintOptions = Common.extend({ stiffness: 0.2 }, constraintOptions);
var softBody = Composites.stack(xx, yy, columns, rows, columnGap, rowGap, function(x, y) { var softBody = Composites.stack(xx, yy, columns, rows, columnGap, rowGap, function(x, y) {
return Bodies.circle(x, y, particleRadius, particleOptions); return Bodies.circle(x, y, particleRadius, particleOptions);