diff --git a/src/game.rs b/src/game.rs index f3df4f0..0db1335 100644 --- a/src/game.rs +++ b/src/game.rs @@ -10,7 +10,7 @@ mod scene; mod set; pub const WORLD_DEPTH: f32 = 0.5; -pub const PLAYER_DEPTH: f32 = 0.5; +pub const PLAYER_DEPTH: f32 = 0.4; pub const PLAYER_SIZE_FRACTION: f32 = 0.8; pub fn game_plugin(app: &mut App) { diff --git a/src/game/player.rs b/src/game/player.rs index 278a261..db03f26 100644 --- a/src/game/player.rs +++ b/src/game/player.rs @@ -34,7 +34,7 @@ impl FromWorld for PlayerSpawnOneshot { } pub(super) fn player_plugin(app: &mut App) { - app.add_systems(Update, (move_player, debug_player_pos)) + app.add_systems(Update, (move_player,)) .init_resource::(); } @@ -77,11 +77,9 @@ fn move_player( } let orig = cam_transform.translation; - println!("{orig:?}"); cam_transform.translation -= ((orig - p_transform.translation.xy().extend(0.0)) / 30.0); if moved { - dbg!(mv); controller.translation = Some(Vec2::new(mv as f32 * 6., 0.)); } } @@ -151,8 +149,8 @@ fn add_player( //custom_shape: todo!(), //custom_mass: todo!(), //up: todo!(), - //offset: todo!(), - //slide: todo!(), + offset: CharacterLength::Absolute(0.01), + slide: true, //autostep: Some(CharacterAutostep { // max_height: CharacterLength::Relative(0.1), // min_width: CharacterLength::Absolute(1.0), @@ -161,10 +159,10 @@ fn add_player( //max_slope_climb_angle: todo!(), //min_slope_slide_angle: todo!(), //apply_impulse_to_dynamic_bodies: todo!(), - //snap_to_ground: Some(CharacterLength::Absolute(1.0)), + // snap_to_ground: Some(CharacterLength::Absolute(100.0)), //filter_flags: todo!(), //filter_groups: todo!(), - //normal_nudge_factor: todo!(), + // normal_nudge_factor: 1., ..Default::default() }); } diff --git a/src/game/scene.rs b/src/game/scene.rs index 696da27..0042c9f 100644 --- a/src/game/scene.rs +++ b/src/game/scene.rs @@ -28,7 +28,8 @@ impl PlayerCoords { pub fn get_collider(&self) -> Collider { let size = 0.5; - Collider::round_cuboid(size, size, 1.0) + Collider::round_cuboid(size, size, 1.5) + // Collider::cuboid(size, size) } } diff --git a/src/main.rs b/src/main.rs index fc95321..d7394ed 100644 --- a/src/main.rs +++ b/src/main.rs @@ -5,7 +5,7 @@ use game::game_plugin; mod game; -const METER: f32 = 60.; +const METER: f32 = 30.; #[derive(States, Debug, Clone, PartialEq, Eq, Hash, Default)] enum AppState { @@ -23,6 +23,18 @@ enum PausedState { } fn main() { + let rapier_config = RapierConfiguration { + scaled_shape_subdivision: 10, + timestep_mode: TimestepMode::Variable { + max_dt: 0.1, + time_scale: 1.0, + substeps: 20, + }, + gravity: Vec2::new(0.0, -9.81 * METER), + physics_pipeline_active: true, + query_pipeline_active: true, + force_update_from_transform_changes: false, + }; App::new() .add_plugins(DefaultPlugins) .add_plugins(RapierPhysicsPlugin::::pixels_per_meter(METER)) @@ -32,6 +44,7 @@ fn main() { .init_state::() .init_state::() .insert_state(AppState::InGame) // TODO dont + .insert_resource(rapier_config) .run(); }