public void CheckForNewIntersection(Collider other) { if (!IntersectingColliders.Contains(other) && shape.Intersects(other.shape)) { OnCollisionEnter?.Invoke(this, new Collision() { Caller = this, otherCollider = other }); } }
public bool Intersects(IShape2D other, bool doubledsided = true) { if (other is Rect rectangle) { return(this.Intersects(rectangle)); } else if (doubledsided) { return(other.Intersects(this, false)); } else { throw new ArgumentException(); } }