1mod drag_state;
2mod follow;
3pub mod shape;
4use std::ops::Add;
5
6use bevy_ecs::prelude::Component;
7use bevy_math::Vec2;
8
9pub use drag_state::*;
10pub use follow::*;
11
12#[derive(Component, Clone, Debug, PartialEq, Eq, Hash)]
13pub struct PhysicalObject;
14
15#[derive(Component, Clone, Debug, PartialEq, Default)]
16pub struct Velocity(pub Vec2);
17
18impl From<Vec2> for Velocity {
19 fn from(velocity: Vec2) -> Self {
20 Velocity(velocity)
21 }
22}
23
24impl Add<Vec2> for &Velocity {
25 type Output = Velocity;
26
27 fn add(self, rhs: Vec2) -> Self::Output {
28 (self.0 + rhs).into()
29 }
30}
31
32impl Add<Velocity> for &Velocity {
33 type Output = Velocity;
34
35 fn add(self, rhs: Velocity) -> Self::Output {
36 (self.0 + rhs.0).into()
37 }
38}