## Description When a kinematic rigid body using `MoveAndSlide` is overlapping any other collider, the following panic occurs immediately: ``` thread 'Compute Task Pool' panicked at bevy_math-0.18.1/src/direction.rs:66:9: Error: The vector given to `Dir2::new_unchecked` is not normalized. The length is 0.05395007. note: run with `RUST_BACKTRACE=1` to display a backtrace Encountered a panic in system `move_and_slide`! ``` ## Versions - `avian2d` 0.6.1 - `bevy` 0.18 ## Minimal reproduction ```rust use avian2d::prelude::*; use bevy::prelude::*; fn main() { App::new() .add_plugins(DefaultPlugins) .add_plugins(PhysicsPlugins::default()) .add_systems(Startup, setup) .add_systems(FixedUpdate, move_bodies) .run(); } const RADIUS: f32 = 25.0; const SPEED: f32 = 150.0; #[derive(Component)] struct Player; fn setup(mut commands: Commands) { commands.spawn(Camera2d); // Kinematic body controlled by WASD. commands.spawn(( Player, RigidBody::Kinematic, CustomPositionIntegration, Collider::circle(RADIUS), Transform::from_xyz(0.0, 0.0, 0.0), LinearVelocity::default(), )); // Static body at the same position (also reproduces with Kinematic) commands.spawn(( RigidBody::Static, Collider::circle(RADIUS), Transform::from_xyz(0.0, 0.0, 0.0), )); } fn move_bodies( mut query: Query<(Entity, &mut Transform, &mut LinearVelocity, &Collider)>, keys: Res<ButtonInput<KeyCode>>, move_and_slide: MoveAndSlide, time: Res<Time>, player: Query<Entity, With<Player>>, ) { let player_entity = player.single().unwrap(); if let Ok((_, _, mut lin_vel, _)) = query.get_mut(player_entity) { let mut dir = Vec2::ZERO; if keys.pressed(KeyCode::KeyW) { dir.y += 1.0; } if keys.pressed(KeyCode::KeyS) { dir.y -= 1.0; } if keys.pressed(KeyCode::KeyA) { dir.x -= 1.0; } if keys.pressed(KeyCode::KeyD) { dir.x += 1.0; } lin_vel.0 = dir.normalize_or_zero() * SPEED; } let entities: Vec<Entity> = query.iter().map(|(e, ..)| e).collect(); for entity in entities { let Ok((entity, mut transform, mut lin_vel, collider)) = query.get_mut(entity) else { continue; }; let MoveAndSlideOutput { position, projected_velocity } = move_and_slide.move_and_slide( collider, transform.translation.xy(), transform.rotation.to_euler(EulerRot::XYZ).2, lin_vel.0, time.delta(), &MoveAndSlideConfig::default(), &SpatialQueryFilter::from_excluded_entities([entity]), |_| MoveAndSlideHitResponse::Accept, ); transform.translation = position.extend(0.0); lin_vel.0 = projected_velocity; } } ``` ## Root cause In `move_and_slide.rs` line 554: ```rust // TODO: Remove this once the collision bug is fixed. let mut first_normal = Dir::new_unchecked(sweep_hit.normal1.f32()); ```