/// <summary> /// Checks for intersection between two BoundingCircles and returns a Vector for a potential colliding position. /// </summary> public bool Intersects(BoundingCircle other, out Vector2? intersectionPosition) { intersectionPosition = null; if (Vector2.DistanceSquared(other.Entity.Position, Entity.Position) <= (other.Radius + Radius) * (other.Radius + Radius)) { Vector2 colDir = other.Entity.Position - Entity.Position; ; colDir.Normalize(); intersectionPosition = Entity.Position + colDir * Radius; return true; } return false; }
/// <summary> /// Checks for intersection between two BoundingCircles. /// </summary> public bool Intersects(BoundingCircle other) { return Vector2.DistanceSquared(other.Entity.Position, Entity.Position) <= (other.Radius + Radius) * (other.Radius + Radius); }
public Radar (GameShip ship, float radius) { this.Bounding = new BoundingCircle(ship, radius); }