Skip to content

Loading…

Fix Arbiter.totalKE() #5

Merged
merged 1 commit into from

2 participants

@parasyte

Fixes a 'cannot access property e of undefined' error.

@josephg josephg merged commit c19d6d6 into josephg:master
@josephg
Owner

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Jul 25, 2012
  1. Fix Arbiter.totalKE()

    Jason Oster committed
Showing with 6 additions and 8 deletions.
  1. +2 −3 cp.js
  2. +2 −2 cp.min.js
  3. +2 −3 lib/cpArbiter.js
View
5 cp.js
@@ -2676,10 +2676,10 @@ Arbiter.prototype.totalImpulseWithFriction = function()
/// This function should only be called from a post-solve, post-step or cpBodyEachArbiter callback.
Arbiter.prototype.totalKE = function()
{
- var eCoef = (1 - arb.e)/(1 + arb.e);
+ var eCoef = (1 - this.e)/(1 + this.e);
var sum = 0;
- var contacts = arb.contacts;
+ var contacts = this.contacts;
for(var i=0, count=contacts.length; i<count; i++){
var con = contacts[i];
var jnAcc = con.jnAcc;
@@ -2973,7 +2973,6 @@ Arbiter.prototype.next = function(body)
{
return (this.body_a == body ? this.thread_a_next : this.thread_b_next);
};
-
/* Copyright (c) 2007 Scott Lembcke
*
* Permission is hereby granted, free of charge, to any person obtaining a copy
View
4 cp.min.js
2 additions, 2 deletions not shown because the diff is too large. Please use a local Git client to view these changes.
View
5 lib/cpArbiter.js
@@ -124,10 +124,10 @@ Arbiter.prototype.totalImpulseWithFriction = function()
/// This function should only be called from a post-solve, post-step or cpBodyEachArbiter callback.
Arbiter.prototype.totalKE = function()
{
- var eCoef = (1 - arb.e)/(1 + arb.e);
+ var eCoef = (1 - this.e)/(1 + this.e);
var sum = 0;
- var contacts = arb.contacts;
+ var contacts = this.contacts;
for(var i=0, count=contacts.length; i<count; i++){
var con = contacts[i];
var jnAcc = con.jnAcc;
@@ -421,4 +421,3 @@ Arbiter.prototype.next = function(body)
{
return (this.body_a == body ? this.thread_a_next : this.thread_b_next);
};
-
Something went wrong with that request. Please try again.