mirror of
https://github.com/liabru/matter-js.git
synced 2025-01-12 16:08:50 -05:00
optimised Pair.create
This commit is contained in:
parent
c1988783db
commit
48673db79f
1 changed files with 4 additions and 4 deletions
|
@ -38,10 +38,10 @@ var Contact = require('./Contact');
|
||||||
timeCreated: timestamp,
|
timeCreated: timestamp,
|
||||||
timeUpdated: timestamp,
|
timeUpdated: timestamp,
|
||||||
inverseMass: parentA.inverseMass + parentB.inverseMass,
|
inverseMass: parentA.inverseMass + parentB.inverseMass,
|
||||||
friction: Math.min(parentA.friction, parentB.friction),
|
friction: parentA.friction < parentB.friction ? parentA.friction : parentB.friction,
|
||||||
frictionStatic: Math.max(parentA.frictionStatic, parentB.frictionStatic),
|
frictionStatic: parentA.frictionStatic > parentB.frictionStatic ? parentA.frictionStatic : parentB.frictionStatic,
|
||||||
restitution: Math.max(parentA.restitution, parentB.restitution),
|
restitution: parentA.restitution > parentB.restitution ? parentA.restitution : parentB.restitution,
|
||||||
slop: Math.max(parentA.slop, parentB.slop)
|
slop: parentA.slop > parentB.slop ? parentA.slop : parentB.slop
|
||||||
};
|
};
|
||||||
|
|
||||||
Pair.update(pair, collision, timestamp);
|
Pair.update(pair, collision, timestamp);
|
||||||
|
|
Loading…
Reference in a new issue