From 7f23383791d8774fe67d3a207947372112133585 Mon Sep 17 00:00:00 2001 From: jsideris Date: Fri, 4 Sep 2020 10:14:06 -0400 Subject: [PATCH] Fix bug setting frictionIterations in gssolver, and where bodies with constraint could be removed from world. --- src/solver/GSSolver.js | 2 +- src/world/World.js | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/src/solver/GSSolver.js b/src/solver/GSSolver.js index 302d7d1c..de35cf3d 100644 --- a/src/solver/GSSolver.js +++ b/src/solver/GSSolver.js @@ -41,7 +41,7 @@ function GSSolver(options){ * @type {Number} * @default 0 */ - this.frictionIterations = options.frictionIterations !== undefined ? 0 : options.frictionIterations; + this.frictionIterations = options.frictionIterations !== undefined ? options.frictionIterations : 0; /** * The number of iterations that were made during the last solve. If .tolerance is zero, this value will always be equal to .iterations, but if .tolerance is larger than zero, and the solver can quit early, then this number will be somewhere between 1 and .iterations. diff --git a/src/world/World.js b/src/world/World.js index 4260c1cb..a6dabb46 100644 --- a/src/world/World.js +++ b/src/world/World.js @@ -1059,7 +1059,7 @@ World.prototype.removeBody = function(body){ var constraints = this.constraints; var l = constraints.length; while (l--) { - if(constraints[l].bodyA === this || constraints[l].bodyB === this){ + if(constraints[l].bodyA === body || constraints[l].bodyB === body){ throw new Error('Cannot remove Body from World: it still has constraints connected to it.'); } }