public IntersectsPoint ( Vector2 point ) : bool | ||
point | Vector2 | |
return | bool |
public override bool IntersectsPoint(Vector2 point)
{
return (point.X > GetLeft() && point.Y > GetTop() && point.X < GetRight() && point.Y < GetBottom());
}
private static bool CollideRectCirc(RectangleCollider a, CircleCollider b) { if (a.IntersectsPoint(b.GetCenter())) return true; //Check the circle against the four edges of the rectangle Vector2 pA = a.GetTopLeft(); Vector2 pB = a.GetTopRight(); Vector2 pC = a.GetBottomRight(); Vector2 pD = a.GetBottomLeft(); if (b.IntersectsLine(pA, pB, 0) || b.IntersectsLine(pB, pC, 0) || b.IntersectsLine(pC, pD, 0) || b.IntersectsLine(pD, pA, 0)) return true; return false; }