use avian3d::{math::*, prelude::*}; use bevy::prelude::*; use super::controller::{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: Res, bodies: Query<&RigidBody>, collider_parents: Query<&ColliderParent, Without>, mut character_controllers: Query< ( &mut Position, &Rotation, &mut LinearVelocity, Option<&MaxSlopeAngle>, ), (With, With), >, time: Res