//tests if two collidables have intersecting shapes public bool ShapesCollide(CollidableShape targetEntity) { foreach (Simplex shape in Shapes) { foreach (Simplex otherShape in targetEntity.Shapes) { //fast early exit, also needed to check if either shape is fully inside the other if (shape.IsPointInShape(otherShape.ShapeCenter)) { return(true); } if (otherShape.IsPointInShape(shape.ShapeCenter)) { return(true); } foreach (Simplex.Edge edge in shape.Edges) { foreach (Simplex.Edge otherEdge in otherShape.Edges) { if (AxMath.LinesIntercect(edge.EdgeLine, otherEdge.EdgeLine)) { return(true); } } } } } return(false); }