mirror of
https://github.com/liabru/matter-js.git
synced 2024-11-27 09:50:52 -05:00
optimised Collision._findSupports
This commit is contained in:
parent
ce03208c5f
commit
653a110d64
1 changed files with 4 additions and 4 deletions
|
@ -275,15 +275,15 @@ var Pair = require('./Pair');
|
|||
bodyAPositionY = bodyA.position.y,
|
||||
normalX = normal.x * direction,
|
||||
normalY = normal.y * direction,
|
||||
nearestDistance = Number.MAX_VALUE,
|
||||
vertexA,
|
||||
vertexB,
|
||||
vertexA = vertices[0],
|
||||
vertexB = vertexA,
|
||||
nearestDistance = normalX * (bodyAPositionX - vertexB.x) + normalY * (bodyAPositionY - vertexB.y),
|
||||
vertexC,
|
||||
distance,
|
||||
j;
|
||||
|
||||
// find deepest vertex relative to the axis
|
||||
for (j = 0; j < verticesLength; j += 1) {
|
||||
for (j = 1; j < verticesLength; j += 1) {
|
||||
vertexB = vertices[j];
|
||||
distance = normalX * (bodyAPositionX - vertexB.x) + normalY * (bodyAPositionY - vertexB.y);
|
||||
|
||||
|
|
Loading…
Reference in a new issue