Skip to content

Commit

Permalink
fix soft body stiffness
Browse files Browse the repository at this point in the history
  • Loading branch information
liabru committed May 3, 2017
1 parent e6babf0 commit 1bae2de
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 2 deletions.
3 changes: 2 additions & 1 deletion examples/cloth.js
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion src/factory/Composites.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down

0 comments on commit 1bae2de

Please sign in to comment.