Enable continuous collision detection and deterministic torque application order.

This commit is contained in:
Joe Ardent 2022-02-17 22:41:13 -08:00
parent 97c3d68a81
commit 8000f1f5b8
2 changed files with 8 additions and 3 deletions

View file

@ -60,6 +60,11 @@ fn setup_bike(bike: Entity, xform: &Transform, commands: &mut Commands) {
..Default::default() ..Default::default()
} }
.into(); .into();
bbody.ccd = RigidBodyCcd {
ccd_enabled: true,
..Default::default()
}
.into();
bbody.mass_properties = bbody.mass_properties =
MassProperties::new(Vec3::ZERO.into(), 0.5, Vec3::new(0.0, 0.01, 0.0).into()).into(); 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()); let isometry = Isometry::from_parts(xform.translation.into(), xform.rotation.into());
@ -141,7 +146,7 @@ impl Plugin for CyberActionPlugin {
.add_plugin(RapierPhysicsPlugin::<NoUserData>::default()) .add_plugin(RapierPhysicsPlugin::<NoUserData>::default())
.add_startup_system_to_stage(StartupStage::PostStartup, setup_colliders) .add_startup_system_to_stage(StartupStage::PostStartup, setup_colliders)
.add_system(gravity) .add_system(gravity)
.add_system(falling_cat) .add_system(falling_cat.label("cat"))
.add_system(update_forces); .add_system(update_forces.after("cat"));
} }
} }

View file

@ -23,7 +23,7 @@ fn spawn_moving_lights(
) { ) {
let rng = &mut thread_rng(); let rng = &mut thread_rng();
// spawn orbiting bisexual lights // spawn orbiting bisexual lights
for _ in 0..255 { for _ in 0..655 {
// mechanics // mechanics
let axis = crate::random_unit_vec(rng); let axis = crate::random_unit_vec(rng);
let angle = rng.gen_range(0.0..TAU); let angle = rng.gen_range(0.0..TAU);