Skip to content

Commit

Permalink
fixed support finding logic
Browse files Browse the repository at this point in the history
  • Loading branch information
liabru committed Feb 25, 2015
1 parent 757fffa commit bc7dfc7
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions src/collision/SAT.js
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ var SAT = {};
if (Vertices.contains(bodyA.vertices, verticesB[0]))
supports.push(verticesB[0]);

if (verticesB[1] && Vertices.contains(bodyA.vertices, verticesB[1]))
if (verticesB.length > 1 && Vertices.contains(bodyA.vertices, verticesB[1]))
supports.push(verticesB[1]);

// find the supports from bodyA that are inside bodyB
Expand All @@ -127,7 +127,7 @@ var SAT = {};
if (Vertices.contains(bodyB.vertices, verticesA[0]))
supports.push(verticesA[0]);

if (verticesA[1] && supports.length < 2 && Vertices.contains(bodyB.vertices, verticesA[1]))
if (verticesA.length > 1 && supports.length < 2 && Vertices.contains(bodyB.vertices, verticesA[1]))
supports.push(verticesA[1]);
}

Expand Down

0 comments on commit bc7dfc7

Please sign in to comment.