Skip to content

Commit dc90561

Browse files
committed
random fixes
1 parent 16e1a47 commit dc90561

File tree

5 files changed

+21
-9
lines changed

5 files changed

+21
-9
lines changed

src/collision/Narrowphase.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@ var bodiesOverlap_shapePositionB = vec2.create();
178178
* @param {Body} bodyA
179179
* @param {Body} bodyB
180180
* @return {Boolean}
181-
* @todo test
181+
* @todo shape world transforms are wrong
182182
*/
183183
Narrowphase.prototype.bodiesOverlap = function(bodyA, bodyB){
184184
var shapePositionA = bodiesOverlap_shapePositionA;

src/constraints/DistanceConstraint.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -107,7 +107,7 @@ function DistanceConstraint(bodyA,bodyB,options){
107107
// g = (xi - xj).dot(n)
108108
// dg/dt = (vi - vj).dot(n) = G*W = [n 0 -n 0] * [vi wi vj wj]'
109109

110-
// ...and if we were to include offset points (TODO for now):
110+
// ...and if we were to include offset points:
111111
// g =
112112
// (xj + rj - xi - ri).dot(n) - distance
113113
//

src/equations/FrictionEquation.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ function FrictionEquation(bodyA, bodyB, slipForce){
3939
this.t = vec2.create();
4040

4141
/**
42-
* A ContactEquation connected to this friction. The contact equations can be used to rescale the max force for the friction. If more than one contact equation is given, then the max force can be set to the average.
42+
* ContactEquations connected to this friction equation. The contact equations can be used to rescale the max force for the friction. If more than one contact equation is given, then the max force can be set to the average.
4343
* @property contactEquations
4444
* @type {ContactEquation}
4545
*/

src/world/World.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -961,9 +961,10 @@ World.prototype.runNarrowphase = function(np,bi,si,xi,ai,bj,sj,xj,aj,cm,glen){
961961
*/
962962
World.prototype.addSpring = function(spring){
963963
this.springs.push(spring);
964-
this.addSpringEvent.spring = spring;
965-
this.emit(this.addSpringEvent);
966-
this.addSpringEvent.spring = null;
964+
var evt = this.addSpringEvent;
965+
evt.spring = spring;
966+
this.emit(evt);
967+
evt.spring = null;
967968
};
968969

969970
/**
@@ -995,9 +996,10 @@ World.prototype.addBody = function(body){
995996
if(this.bodies.indexOf(body) === -1){
996997
this.bodies.push(body);
997998
body.world = this;
998-
this.addBodyEvent.body = body;
999-
this.emit(this.addBodyEvent);
1000-
this.addBodyEvent.body = null;
999+
var evt = this.addBodyEvent;
1000+
evt.body = body;
1001+
this.emit(evt);
1002+
evt.body = null;
10011003
}
10021004
};
10031005

test/collision/Narrowphase.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -346,3 +346,13 @@ exports.reset = function(test){
346346
test.done();
347347
};
348348

349+
350+
exports.bodiesOverlap = function(test){
351+
bodyA.addShape(new Circle(1));
352+
bodyB.addShape(new Circle(1));
353+
test.ok(narrowphase.bodiesOverlap(bodyA, bodyB));
354+
bodyB.position[0] = 10;
355+
test.ok(!narrowphase.bodiesOverlap(bodyA, bodyB));
356+
test.done();
357+
};
358+

0 commit comments

Comments
 (0)