diff --git a/assets/player.png b/assets/player.png deleted file mode 100644 index 97557cd..0000000 Binary files a/assets/player.png and /dev/null differ diff --git a/assets/player.png b/assets/player.png new file mode 120000 index 0000000..e413cde --- /dev/null +++ b/assets/player.png @@ -0,0 +1 @@ +/home/mitchell/Pictures/player.png \ No newline at end of file diff --git a/src/avian.rs b/src/avian.rs index 2992c45..90b879c 100644 --- a/src/avian.rs +++ b/src/avian.rs @@ -6,15 +6,7 @@ pub struct CharacterControllerPlugin; impl Plugin for CharacterControllerPlugin { fn build(&self, app: &mut App) { app.add_message::() - .add_systems(Update, ((keyboard_input, gamepad_input), movement).chain()) - .add_systems( - // Run collision handling after collision detection. - // - // NOTE: The collision implementation here is very basic and a bit buggy. - // A collide-and-slide algorithm would likely work better. - PhysicsSchedule, - kinematic_controller_collisions.in_set(NarrowPhaseSystems::Last), - ); + .add_systems(Update, ((keyboard_input, gamepad_input), movement).chain()); } } @@ -51,8 +43,8 @@ impl CharacterControllerBundle { character_controller: CharacterController, body: RigidBody::Kinematic, collider, - speed: MaxSpeed(100.), - acceleration: MaxAcceleration(1000.), + speed: MaxSpeed(300.), + acceleration: MaxAcceleration(5000.), } } } @@ -109,6 +101,7 @@ fn movement( for (max_speed, max_acceleration, mut linear_velocity) in &mut controllers { while movement_reader.len() > 1 { + warn!("Extra movement message. Ignoring"); movement_reader.read(); } @@ -128,122 +121,3 @@ fn movement( **linear_velocity += delta; } } - -/// Kinematic bodies do not get pushed by collisions by default, -/// so it needs to be done manually. -/// -/// This system handles collision response for kinematic character controllers -/// by pushing them along their contact normals by the current penetration depth, -/// and applying velocity corrections in order to snap to slopes, slide along walls, -/// and predict collisions using speculative contacts. -#[allow(clippy::type_complexity)] -fn kinematic_controller_collisions( - collisions: Collisions, - bodies: Query<&RigidBody>, - collider_rbs: Query<&ColliderOf, Without>, - mut character_controllers: Query< - (&mut Position, &mut LinearVelocity), - (With, With), - >, - time: Res