Permalink
Browse files

Merge pull request #9 from tnovelli/master

fix Body.getVelAtPoint etc and (hopefully) Body.eachConstraint
  • Loading branch information...
2 parents 190f84c + e3c3ae0 commit d0a855bb6e405da95c1d6e065b2dbe9704b7eb82 @nornagon nornagon committed Oct 8, 2012
Showing with 4 additions and 4 deletions.
  1. +4 −4 lib/cpBody.js
View
8 lib/cpBody.js
@@ -292,19 +292,19 @@ Body.prototype.applyImpulse = function(j, r)
Body.prototype.getVelAtPoint = function(r)
{
- return vadd(new Vect(this.vx, this.vy), vmult(vperp(r), body.w));
+ return vadd(new Vect(this.vx, this.vy), vmult(vperp(r), this.w));
};
/// Get the velocity on a body (in world units) at a point on the body in world coordinates.
Body.prototype.getVelAtWorldPoint = function(point)
{
- return this.getVelAtPoint(vsub(point, body.p));
+ return this.getVelAtPoint(vsub(point, this.p));
};
/// Get the velocity on a body (in world units) at a point on the body in local coordinates.
Body.prototype.getVelAtLocalPoint = function(point)
{
- return this.getVelAtPoint(vrotate(point, body.rot));
+ return this.getVelAtPoint(vrotate(point, this.rot));
};
Body.prototype.eachShape = function(func)
@@ -318,7 +318,7 @@ Body.prototype.eachConstraint = function(func)
{
var constraint = this.constraintList;
while(constraint) {
- var next = constraint.next(body);
+ var next = constraint.next(this);
func(constraint);
constraint = next;
}

0 comments on commit d0a855b

Please sign in to comment.