mirror of
https://github.com/liabru/matter-js.git
synced 2024-11-23 09:26:51 -05:00
fix soft body stiffness
This commit is contained in:
parent
e6babf04a8
commit
1bae2dee45
2 changed files with 3 additions and 2 deletions
|
@ -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;
|
||||||
|
|
|
@ -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);
|
||||||
|
|
Loading…
Reference in a new issue