From f847f4c83e1e605e858e4c6e95cb327ceffd5ccb Mon Sep 17 00:00:00 2001 From: liabru Date: Sun, 5 Dec 2021 19:30:35 +0000 Subject: [PATCH] optimised Resolver.solvePosition --- src/collision/Resolver.js | 9 ++------- 1 file changed, 2 insertions(+), 7 deletions(-) diff --git a/src/collision/Resolver.js b/src/collision/Resolver.js index 00302a5..ba69d26 100644 --- a/src/collision/Resolver.js +++ b/src/collision/Resolver.js @@ -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++) {