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,
|
bodyAPositionY = bodyA.position.y,
|
||||||
normalX = normal.x * direction,
|
normalX = normal.x * direction,
|
||||||
normalY = normal.y * direction,
|
normalY = normal.y * direction,
|
||||||
nearestDistance = Number.MAX_VALUE,
|
vertexA = vertices[0],
|
||||||
vertexA,
|
vertexB = vertexA,
|
||||||
vertexB,
|
nearestDistance = normalX * (bodyAPositionX - vertexB.x) + normalY * (bodyAPositionY - vertexB.y),
|
||||||
vertexC,
|
vertexC,
|
||||||
distance,
|
distance,
|
||||||
j;
|
j;
|
||||||
|
|
||||||
// find deepest vertex relative to the axis
|
// find deepest vertex relative to the axis
|
||||||
for (j = 0; j < verticesLength; j += 1) {
|
for (j = 1; j < verticesLength; j += 1) {
|
||||||
vertexB = vertices[j];
|
vertexB = vertices[j];
|
||||||
distance = normalX * (bodyAPositionX - vertexB.x) + normalY * (bodyAPositionY - vertexB.y);
|
distance = normalX * (bodyAPositionX - vertexB.x) + normalY * (bodyAPositionY - vertexB.y);
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue