use lotus_proc_macros::Component;
#[derive(Clone, Default, PartialEq)]
pub enum BodyType {
Static,
Dynamic,
#[default]
Kinematic
}
#[derive(Clone, Component)]
pub struct RigidBody {
pub body_type: BodyType,
pub mass: f32,
pub restitution: f32,
pub friction: f32,
pub rest: bool
}
impl RigidBody {
pub fn new(body_type: BodyType, mass: f32, restitution: f32, friction: f32) -> Self {
return Self {
body_type,
mass,
restitution,
friction,
rest: false
};
}
pub fn new_simple(body_type: BodyType, mass: f32) -> Self {
return Self {
body_type,
mass,
restitution: 1.0,
friction: 1.0,
rest: false
};
}
}