Skip to content

Commit

Permalink
Merge pull request #36 from ConfidantCommunications/fixes
Browse files Browse the repository at this point in the history
Fixed some leftover AS3 code.
  • Loading branch information
joshtynjala committed Sep 3, 2024
2 parents adfc97d + f9a9a25 commit eb35a8e
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions box2D/dynamics/controllers/B2GravityController.hx
Original file line number Diff line number Diff line change
Expand Up @@ -97,26 +97,25 @@ class B2GravityController extends B2Controller
body1 = i.body;
p1 = body1.getWorldCenter();
mass1 = body1.getMass();
for (j = m_bodyList;
j != i;
j = j.nextBody
)
{
j = m_bodyList;
while (j != i)
{
body2 = j.body;
p2 = body2.getWorldCenter()
p2 = body2.getWorldCenter();
dx = p2.x - p1.x;
dy = p2.y - p1.y;
r2 = dx * dx + dy * dy;
if (r2 < B2Math.MIN_VALUE)
{
i = i.nextBody;
j = j.nextBody;
continue;
}
f = new B2Vec2(dx, dy);
f.multiply(G / r2 * mass1 * body2.getMass());
if (body1.isAwake()) body1.applyForce(f, p1);
f.multiply(-1);
if (body2.isAwake()) body2.applyForce(f, p2);
j = j.nextBody;
}
i = i.nextBody;
}
Expand Down

0 comments on commit eb35a8e

Please sign in to comment.