From 8000f1f5b8bbc06274c3d2c18822468791c8cb6b Mon Sep 17 00:00:00 2001 From: Joe Ardent Date: Thu, 17 Feb 2022 22:41:13 -0800 Subject: [PATCH] Enable continuous collision detection and deterministic torque application order. --- src/action.rs | 9 +++++++-- src/lights.rs | 2 +- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/src/action.rs b/src/action.rs index 358f0af..39a4e2c 100644 --- a/src/action.rs +++ b/src/action.rs @@ -60,6 +60,11 @@ fn setup_bike(bike: Entity, xform: &Transform, commands: &mut Commands) { ..Default::default() } .into(); + bbody.ccd = RigidBodyCcd { + ccd_enabled: true, + ..Default::default() + } + .into(); bbody.mass_properties = MassProperties::new(Vec3::ZERO.into(), 0.5, Vec3::new(0.0, 0.01, 0.0).into()).into(); let isometry = Isometry::from_parts(xform.translation.into(), xform.rotation.into()); @@ -141,7 +146,7 @@ impl Plugin for CyberActionPlugin { .add_plugin(RapierPhysicsPlugin::::default()) .add_startup_system_to_stage(StartupStage::PostStartup, setup_colliders) .add_system(gravity) - .add_system(falling_cat) - .add_system(update_forces); + .add_system(falling_cat.label("cat")) + .add_system(update_forces.after("cat")); } } diff --git a/src/lights.rs b/src/lights.rs index 6493aae..dc5d6d4 100644 --- a/src/lights.rs +++ b/src/lights.rs @@ -23,7 +23,7 @@ fn spawn_moving_lights( ) { let rng = &mut thread_rng(); // spawn orbiting bisexual lights - for _ in 0..255 { + for _ in 0..655 { // mechanics let axis = crate::random_unit_vec(rng); let angle = rng.gen_range(0.0..TAU);