blob: df87b68ea6751bc08391f2f21c9168f9a774f2f5 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
|
use geometry::*;
pub trait CircleHitbox {
fn pos(&self) -> Vec2d;
fn radius(&self) -> f64;
fn touches_point(&self, point: Vec2d) -> bool {
self.pos().distance(point) <= self.radius()
}
fn touches_circle(&self, other: &CircleHitbox) -> bool {
self.pos().distance(other.pos()) <= self.radius() + other.radius()
}
}
|