use avian3d::{math::*, prelude::*}; use bevy::prelude::*; use super::controller_common::{CharacterController, MaxSlopeAngle}; /// 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)] pub fn kinematic_controller_collisions( collisions: Collisions, bodies: Query<&RigidBody>, collider_rbs: Query<&ColliderOf, Without>, mut character_controllers: Query< (&mut Position, &mut LinearVelocity, Option<&MaxSlopeAngle>), (With, With), >, time: Res