Player motion and forces

This commit is contained in:
2025-06-24 16:49:59 -04:00
parent 1e70c0a42d
commit 8c3281f9cc
6 changed files with 114 additions and 10 deletions

21
src/components/player.rs Normal file
View 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);