From 4bff36d7bb730f050cbb808ed844cdf7519e383a Mon Sep 17 00:00:00 2001 From: FatBoy-DOTC Date: Sun, 7 Jan 2024 19:14:18 -0600 Subject: [PATCH] cleanup and comment --- src/engine/CollisionEngine/Mesh.java | 14 ++++---------- 1 file changed, 4 insertions(+), 10 deletions(-) diff --git a/src/engine/CollisionEngine/Mesh.java b/src/engine/CollisionEngine/Mesh.java index 379cefc6..c4d9727f 100644 --- a/src/engine/CollisionEngine/Mesh.java +++ b/src/engine/CollisionEngine/Mesh.java @@ -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;