|
|
|
@ -22,22 +22,16 @@ public class Mesh {
@@ -22,22 +22,16 @@ public class Mesh {
|
|
|
|
|
|
|
|
|
|
public boolean MeshCollides(Line2D line, float charHeight, float charY){ |
|
|
|
|
|
|
|
|
|
//movement path does not intersect this mesh
|
|
|
|
|
//if(line.intersects(boundsRect) == false)
|
|
|
|
|
//check if movement path intersects this mesh
|
|
|
|
|
if(!this.BoundsCollides(line)) |
|
|
|
|
return false; |
|
|
|
|
|
|
|
|
|
//character moving is higher than the max Y of this mesh
|
|
|
|
|
float feet = charY; |
|
|
|
|
float head = feet + charHeight; |
|
|
|
|
|
|
|
|
|
if(head < this.minY && feet > this.maxY){ |
|
|
|
|
//check to see if the mesh collides between the characters feet and head locations
|
|
|
|
|
if((charY + charHeight) < this.minY && charY > this.maxY){ |
|
|
|
|
return false; |
|
|
|
|
} |
|
|
|
|
|
|
|
|
|
//if(charY > this.maxY && charHeight + charY < this.minY)
|
|
|
|
|
// return false;
|
|
|
|
|
|
|
|
|
|
//check if any triangles intersect the movement path
|
|
|
|
|
for(Triangle tri : triangles) |
|
|
|
|
if(tri.collides(line)) |
|
|
|
|
return true; |
|
|
|
|