Skip to content

Commit f847f4c

Browse files
committed
optimised Resolver.solvePosition
1 parent 52e7977 commit f847f4c

File tree

1 file changed

+2
-7
lines changed

1 file changed

+2
-7
lines changed

src/collision/Resolver.js

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -73,15 +73,10 @@ var Bounds = require('../geometry/Bounds');
7373
bodyB = collision.parentB;
7474
normal = collision.normal;
7575

76-
// TODO: behaviour change: replace with fully simplified version
7776
// get current separation between body edges involved in collision
7877
pair.separation =
79-
normal.x * (
80-
(bodyB.positionImpulse.x + bodyB.position.x) - (bodyA.positionImpulse.x + (bodyB.position.x - collision.penetration.x))
81-
)
82-
+ normal.y * (
83-
(bodyB.positionImpulse.y + bodyB.position.y) - (bodyA.positionImpulse.y + (bodyB.position.y - collision.penetration.y))
84-
);
78+
normal.x * (bodyB.positionImpulse.x + collision.penetration.x - bodyA.positionImpulse.x)
79+
+ normal.y * (bodyB.positionImpulse.y + collision.penetration.y - bodyA.positionImpulse.y);
8580
}
8681

8782
for (i = 0; i < pairsLength; i++) {

0 commit comments

Comments
 (0)