Skip to content
This repository
Browse code

Merge pull request #9 from tnovelli/master

fix Body.getVelAtPoint etc and (hopefully) Body.eachConstraint
  • Loading branch information...
commit d0a855bb6e405da95c1d6e065b2dbe9704b7eb82 2 parents 190f84c + e3c3ae0
Jeremy Apthorp nornagon authored

Showing 1 changed file with 4 additions and 4 deletions. Show diff stats Hide diff stats

  1. +4 4 lib/cpBody.js
8 lib/cpBody.js
@@ -292,19 +292,19 @@ Body.prototype.applyImpulse = function(j, r)
292 292
293 293 Body.prototype.getVelAtPoint = function(r)
294 294 {
295   - return vadd(new Vect(this.vx, this.vy), vmult(vperp(r), body.w));
  295 + return vadd(new Vect(this.vx, this.vy), vmult(vperp(r), this.w));
296 296 };
297 297
298 298 /// Get the velocity on a body (in world units) at a point on the body in world coordinates.
299 299 Body.prototype.getVelAtWorldPoint = function(point)
300 300 {
301   - return this.getVelAtPoint(vsub(point, body.p));
  301 + return this.getVelAtPoint(vsub(point, this.p));
302 302 };
303 303
304 304 /// Get the velocity on a body (in world units) at a point on the body in local coordinates.
305 305 Body.prototype.getVelAtLocalPoint = function(point)
306 306 {
307   - return this.getVelAtPoint(vrotate(point, body.rot));
  307 + return this.getVelAtPoint(vrotate(point, this.rot));
308 308 };
309 309
310 310 Body.prototype.eachShape = function(func)
@@ -318,7 +318,7 @@ Body.prototype.eachConstraint = function(func)
318 318 {
319 319 var constraint = this.constraintList;
320 320 while(constraint) {
321   - var next = constraint.next(body);
  321 + var next = constraint.next(this);
322 322 func(constraint);
323 323 constraint = next;
324 324 }

0 comments on commit d0a855b

Please sign in to comment.
Something went wrong with that request. Please try again.