From 3daf5edb1ade6bead5afccd086b0f524599bfa08 Mon Sep 17 00:00:00 2001 From: Moxious Date: Mon, 15 Jan 2018 11:48:57 -0500 Subject: [PATCH] tweaks to COF and starting constant velocity --- src/model/World.js | 6 +++--- src/model/worlds/BouncingBalls.js | 2 +- src/model/worlds/bumpers/SimpleGridBumpers.js | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/model/World.js b/src/model/World.js index 235280a..85fc2f2 100644 --- a/src/model/World.js +++ b/src/model/World.js @@ -134,13 +134,13 @@ export default class World { const bodyProps = _.merge({ x: numberDefault(opts.x, Math.random() * renderer.width), y: numberDefault(opts.y, 0), - vx: numberDefault(opts.vx, (Math.random() * 0.5 * (neg ? -1 : 1))), - vy: numberDefault(opts.vy, (Math.random() * 0.5 * (neg ? -1 : 1))), + vx: numberDefault(opts.vx, (0.2/*Math.random() * 0.4 */* (neg ? -1 : 1))), + vy: numberDefault(opts.vy, (0.2/*Math.random() * 0.4 */* (neg ? -1 : 1))), mass: opts.mass || 0.1, // cannot be zero. radius: numberDefault(opts.radius, 20), width: numberDefault(opts.width, 30), height: numberDefault(opts.height, 30), - cof: numberDefault(opts.cof, 0.7), + cof: numberDefault(opts.cof, 0), label: opts.label || 'body-' + (++this.bodyCounter), restitution: numberDefault(opts.restitution, 1), treatment: opts.treatment || 'dynamic', diff --git a/src/model/worlds/BouncingBalls.js b/src/model/worlds/BouncingBalls.js index 96397cc..81d74ae 100644 --- a/src/model/worlds/BouncingBalls.js +++ b/src/model/worlds/BouncingBalls.js @@ -67,7 +67,7 @@ export default class BouncingBalls extends World { var edgeBounce = Physics.behavior('edge-collision-detection', { aabb: viewportBounds, restitution: 1, - cof: 1, + cof: 0, }); // resize events diff --git a/src/model/worlds/bumpers/SimpleGridBumpers.js b/src/model/worlds/bumpers/SimpleGridBumpers.js index b1ad706..8ef371d 100644 --- a/src/model/worlds/bumpers/SimpleGridBumpers.js +++ b/src/model/worlds/bumpers/SimpleGridBumpers.js @@ -49,7 +49,7 @@ export default class SimpleGridBumpers extends Bumpers { vertices: shapes.random(), treatment: 'static', restitution: 1, - cof: 1, + cof: 0, styles: this.component.styleBumper(), })); }