diff --git a/examples/chains.js b/examples/chains.js index c019b9d..91b08b2 100644 --- a/examples/chains.js +++ b/examples/chains.js @@ -43,7 +43,7 @@ Example.chains = function() { return Bodies.rectangle(x, y, 50, 20, { collisionFilter: { group: group } }); }); - Composites.chain(ropeA, 0.5, 0, -0.5, 0, { stiffness: 0.8, length: 2 }); + Composites.chain(ropeA, 0.5, 0, -0.5, 0, { stiffness: 0.8, length: 2, render: { type: 'line' } }); Composite.add(ropeA, Constraint.create({ bodyB: ropeA.bodies[0], pointB: { x: -25, y: 0 }, @@ -57,7 +57,7 @@ Example.chains = function() { return Bodies.circle(x, y, 20, { collisionFilter: { group: group } }); }); - Composites.chain(ropeB, 0.5, 0, -0.5, 0, { stiffness: 0.8, length: 2 }); + Composites.chain(ropeB, 0.5, 0, -0.5, 0, { stiffness: 0.8, length: 2, render: { type: 'line' } }); Composite.add(ropeB, Constraint.create({ bodyB: ropeB.bodies[0], pointB: { x: -20, y: 0 }, diff --git a/examples/doublePendulum.js b/examples/doublePendulum.js index bef6958..70dec15 100644 --- a/examples/doublePendulum.js +++ b/examples/doublePendulum.js @@ -42,7 +42,7 @@ Example.doublePendulum = function() { length = 200, width = 25; - var pendulum = Composites.stack(350, 160, 2, 1, 0, 0, function(x, y) { + var pendulum = Composites.stack(350, 160, 2, 1, -20, 0, function(x, y) { return Bodies.rectangle(x, y, length, width, { collisionFilter: { group: group }, frictionAir: 0, @@ -56,24 +56,26 @@ Example.doublePendulum = function() { pendulum.bodies[0].render.strokeStyle = '#4a485b'; pendulum.bodies[1].render.strokeStyle = '#4a485b'; + + world.gravity.scale = 0.002; - Composites.chain(pendulum, 0.5, 0, -0.5, 0, { + Composites.chain(pendulum, 0.45, 0, -0.45, 0, { stiffness: 1, length: 0, angularStiffness: 0.7, render: { - lineWidth: 0 + strokeStyle: '#4a485b' } }); Composite.add(pendulum, Constraint.create({ bodyB: pendulum.bodies[0], - pointB: { x: -length * 0.5, y: 0 }, - pointA: { x: pendulum.bodies[0].position.x - length * 0.5, y: pendulum.bodies[0].position.y }, + pointB: { x: -length * 0.42, y: 0 }, + pointA: { x: pendulum.bodies[0].position.x - length * 0.42, y: pendulum.bodies[0].position.y }, stiffness: 1, length: 0, render: { - lineWidth: 0 + strokeStyle: '#4a485b' } })); diff --git a/src/factory/Composites.js b/src/factory/Composites.js index 7ef9f3f..3c9adf7 100644 --- a/src/factory/Composites.js +++ b/src/factory/Composites.js @@ -274,10 +274,7 @@ var Bodies = require('./Bodies'); pointB: { x: wheelAOffset, y: wheelYOffset }, bodyA: wheelA, stiffness: 1, - length: 0, - render: { - lineWidth: 0 - } + length: 0 }); var axelB = Constraint.create({ @@ -285,10 +282,7 @@ var Bodies = require('./Bodies'); pointB: { x: wheelBOffset, y: wheelYOffset }, bodyA: wheelB, stiffness: 1, - length: 0, - render: { - lineWidth: 0 - } + length: 0 }); Composite.addBody(car, body); @@ -317,7 +311,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.2 }, constraintOptions); + constraintOptions = Common.extend({ stiffness: 0.2, render: { type: 'line', anchors: false } }, constraintOptions); var softBody = Composites.stack(xx, yy, columns, rows, columnGap, rowGap, function(x, y) { return Bodies.circle(x, y, particleRadius, particleOptions);