Player motion and forces
This commit is contained in:
21
src/components/player.rs
Normal file
21
src/components/player.rs
Normal file
@@ -0,0 +1,21 @@
|
||||
use bevy::prelude::*;
|
||||
use bevy_rapier3d::prelude::GravityScale;
|
||||
|
||||
#[derive(Component, Default, Reflect)]
|
||||
#[require(PlayerVelocity)]
|
||||
pub struct PlayerMotion(pub Vec3);
|
||||
|
||||
#[derive(Component, Default, Reflect)]
|
||||
pub struct PlayerForce(pub Vec3);
|
||||
|
||||
#[derive(Component, Default, Reflect)]
|
||||
#[require(GravityScale)]
|
||||
pub struct GravityDirection(pub Option<Dir3>);
|
||||
|
||||
impl GravityDirection {
|
||||
pub const DOWN: GravityDirection = GravityDirection(Some(Dir3::NEG_Y));
|
||||
pub const NONE: GravityDirection = GravityDirection(None);
|
||||
}
|
||||
|
||||
#[derive(Component, Default, Reflect)]
|
||||
pub struct PlayerVelocity(pub Vec3);
|
||||
Reference in New Issue
Block a user