From 1bae2dee459b1f542ef2c0e24f3cb3aae98bc571 Mon Sep 17 00:00:00 2001 From: liabru Date: Wed, 3 May 2017 21:42:41 +0100 Subject: [PATCH] fix soft body stiffness --- examples/cloth.js | 3 ++- src/factory/Composites.js | 2 +- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/examples/cloth.js b/examples/cloth.js index 7586cf0..001fca7 100644 --- a/examples/cloth.js +++ b/examples/cloth.js @@ -34,7 +34,8 @@ Example.cloth = function() { // add bodies var group = Body.nextGroup(true), 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++) { cloth.bodies[i].isStatic = true; diff --git a/src/factory/Composites.js b/src/factory/Composites.js index c6c75c7..7ef9f3f 100644 --- a/src/factory/Composites.js +++ b/src/factory/Composites.js @@ -317,7 +317,7 @@ var Bodies = require('./Bodies'); */ Composites.softBody = function(xx, yy, columns, rows, columnGap, rowGap, crossBrace, particleRadius, particleOptions, constraintOptions) { 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) { return Bodies.circle(x, y, particleRadius, particleOptions);