public virtual ProximityResult DetectProximity(IEntity other) { ProximityResult res = new ProximityResult(); res.Bearing = MatrixPoint.OrientationBetween(this.Centre, other.Centre); res.Distance = MatrixPoint.DistanceBetween(this.Centre, other.Centre); res.Collision = false; res.Entity = other; List<Line> myOutline = this.GetPerimeter(); List<Line> otherOutline = other.GetPerimeter(); int myCount = myOutline.Count; int otherCount = otherOutline.Count; for (int i = 0; i < myCount; i++) { for (int j = 0; j < otherCount; j++) { if (myOutline[i].Intersects(otherOutline[j])) { res.Collision = true; return res; } } } return res; }