veloren/common/src/comp/phys.rs

54 lines
1.2 KiB
Rust
Raw Normal View History

use specs::{Component, FlaggedStorage, NullStorage};
use specs_idvs::IDVStorage;
2019-07-29 19:54:58 +00:00
use vek::*;
2019-01-02 19:22:01 +00:00
// Position
#[derive(Copy, Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
2019-01-02 19:22:01 +00:00
pub struct Pos(pub Vec3<f32>);
impl Component for Pos {
type Storage = IDVStorage<Self>;
2019-01-02 19:22:01 +00:00
}
// Velocity
#[derive(Copy, Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
2019-01-02 19:22:01 +00:00
pub struct Vel(pub Vec3<f32>);
impl Component for Vel {
type Storage = IDVStorage<Self>;
2019-01-02 19:22:01 +00:00
}
// Orientation
#[derive(Copy, Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Ori(pub Vec3<f32>);
2019-01-02 19:22:01 +00:00
impl Component for Ori {
type Storage = IDVStorage<Self>;
}
// Scale
#[derive(Copy, Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct Scale(pub f32);
impl Component for Scale {
type Storage = FlaggedStorage<Self, IDVStorage<Self>>;
}
// PhysicsState
#[derive(Copy, Clone, Default, Debug, PartialEq, Serialize, Deserialize)]
pub struct PhysicsState {
pub on_ground: bool,
}
impl Component for PhysicsState {
type Storage = FlaggedStorage<Self, IDVStorage<Self>>;
}
// ForceUpdate
#[derive(Copy, Clone, Debug, Default, PartialEq, Serialize, Deserialize)]
pub struct ForceUpdate;
impl Component for ForceUpdate {
type Storage = NullStorage<Self>;
}