Skip to content

Commit

Permalink
optimised Resolver.solvePosition
Browse files Browse the repository at this point in the history
  • Loading branch information
liabru committed Dec 5, 2021
1 parent 52e7977 commit f847f4c
Showing 1 changed file with 2 additions and 7 deletions.
9 changes: 2 additions & 7 deletions src/collision/Resolver.js
Original file line number Diff line number Diff line change
Expand Up @@ -73,15 +73,10 @@ var Bounds = require('../geometry/Bounds');
bodyB = collision.parentB;
normal = collision.normal;

// TODO: behaviour change: replace with fully simplified version
// get current separation between body edges involved in collision
pair.separation =
normal.x * (
(bodyB.positionImpulse.x + bodyB.position.x) - (bodyA.positionImpulse.x + (bodyB.position.x - collision.penetration.x))
)
+ normal.y * (
(bodyB.positionImpulse.y + bodyB.position.y) - (bodyA.positionImpulse.y + (bodyB.position.y - collision.penetration.y))
);
normal.x * (bodyB.positionImpulse.x + collision.penetration.x - bodyA.positionImpulse.x)
+ normal.y * (bodyB.positionImpulse.y + collision.penetration.y - bodyA.positionImpulse.y);
}

for (i = 0; i < pairsLength; i++) {
Expand Down

0 comments on commit f847f4c

Please sign in to comment.