Skip to content

Commit

Permalink
Fixed some leftover AS3 code.
Browse files Browse the repository at this point in the history
  • Loading branch information
ConfidantCommunications committed Oct 4, 2023
1 parent 7749359 commit f9a9a25
Showing 1 changed file with 7 additions and 8 deletions.
15 changes: 7 additions & 8 deletions box2D/dynamics/controllers/B2GravityController.hx
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ class B2GravityController extends B2Controller
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;
Expand All @@ -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 f9a9a25

Please sign in to comment.