Rust: bevy_rapier2d 0.22.0 doesn't detect obvious collisions


I would like to see the following code example spamming "Received collision event: ..." in stdout.


After cargo run you will see two red squares representing colliders of 2 entities. One is hero, the other is enemy.
I believe there's a collision between them as one collider is inside the other.
Unfortunately, bevy_rapier2d doesn't seem to produce any collision events.

Code example

use {bevy::prelude::*, bevy_rapier2d::prelude::*};

fn main() {
        .add_systems(Startup, (spawn_camera, spawn_hero, spawn_enemy))
        .add_systems(Update, (detect_collisions,))

fn spawn_camera(mut cmds: Commands) {
fn spawn_hero(mut cmds: Commands) {
        Collider::cuboid(100., 100.),
        ActiveEvents::COLLISION_EVENTS, // Hero collisions are to always have effect.
fn spawn_enemy(mut cmds: Commands) {
        Collider::cuboid(70., 70.),
        // ActiveEvents::COLLISION_EVENTS,
        /* Enemy may collide with other enemies which should have
        no effect */
/// In future this func. will be replaced with real collision handling (eg. player takes demage)
pub fn detect_collisions(mut collision_events: EventReader<CollisionEvent>) {
    println!("`detect_collisions` system tries to find collisions...");
    for collision_event in collision_events.iter() {
        println!("Received collision event: {:?}", collision_event);

I copied the Cargo.toml from my original game to ensure that my bug is reproduced in the same environment.

name = "bevy_template"
version = "0.1.0"
edition = "2021"

bevy = {version="0.11", features=["dynamic_linking"]}
bevy-inspector-egui = "0.19.0"
bevy_rapier2d = "0.22.0"
derive_more = "0.99.17"

opt-level = 1
opt-level = 3

From surveying

I understood that Sensors with ActiveEvents::COLLISION_EVENTS should always generate CollisionEvents when one Collider is touching another.

Full scenario

In my game, there's an enemy that slowly moves toward the hero and their bodies start to overlap, but no event is produced at any phase of their convergence.

This Bevy example code may help:

Unfortunately, this is just an implementation of a simplified collision system/engine.
But what I want is a general purpose, simple and efficient collision engine that can handle 10000 collisions.
I thought bevy_rapier2d would come up to my expectations.