From 1073ddeecf1a28d42570455bd93152f8faaddf2c Mon Sep 17 00:00:00 2001 From: liabru Date: Mon, 26 Apr 2021 23:53:18 +0100 Subject: [PATCH] optimised Pair.update --- src/collision/Pair.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/collision/Pair.js b/src/collision/Pair.js index 049a8571..a48754b1 100644 --- a/src/collision/Pair.js +++ b/src/collision/Pair.js @@ -65,10 +65,10 @@ var Contact = require('./Contact'); pair.collision = collision; pair.inverseMass = parentA.inverseMass + parentB.inverseMass; - pair.friction = Math.min(parentA.friction, parentB.friction); - pair.frictionStatic = Math.max(parentA.frictionStatic, parentB.frictionStatic); - pair.restitution = Math.max(parentA.restitution, parentB.restitution); - pair.slop = Math.max(parentA.slop, parentB.slop); + pair.friction = parentA.friction < parentB.friction ? parentA.friction : parentB.friction; + pair.frictionStatic = parentA.frictionStatic > parentB.frictionStatic ? parentA.frictionStatic : parentB.frictionStatic; + pair.restitution = parentA.restitution > parentB.restitution ? parentA.restitution : parentB.restitution; + pair.slop = parentA.slop > parentB.slop ? parentA.slop : parentB.slop; activeContacts.length = 0; if (collision.collided) {