Browse Source

cleanup and comment

server-collision
FatBoy-DOTC 12 months ago
parent
commit
4bff36d7bb
  1. 14
      src/engine/CollisionEngine/Mesh.java

14
src/engine/CollisionEngine/Mesh.java

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

Loading…
Cancel
Save