0
0
Fork 0
mirror of https://github.com/liabru/matter-js.git synced 2024-12-25 13:39:06 -05:00

optimised Pair.create

This commit is contained in:
liabru 2021-04-26 23:52:35 +01:00
parent c1988783db
commit 48673db79f

View file

@ -38,10 +38,10 @@ var Contact = require('./Contact');
timeCreated: timestamp,
timeUpdated: timestamp,
inverseMass: parentA.inverseMass + parentB.inverseMass,
friction: Math.min(parentA.friction, parentB.friction),
frictionStatic: Math.max(parentA.frictionStatic, parentB.frictionStatic),
restitution: Math.max(parentA.restitution, parentB.restitution),
slop: Math.max(parentA.slop, parentB.slop)
friction: parentA.friction < parentB.friction ? parentA.friction : parentB.friction,
frictionStatic: parentA.frictionStatic > parentB.frictionStatic ? parentA.frictionStatic : parentB.frictionStatic,
restitution: parentA.restitution > parentB.restitution ? parentA.restitution : parentB.restitution,
slop: parentA.slop > parentB.slop ? parentA.slop : parentB.slop
};
Pair.update(pair, collision, timestamp);