aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--benchmarks2d/all_benchmarks2.rs2
-rw-r--r--benchmarks2d/vertical_stacks2.rs47
-rw-r--r--src/dynamics/integration_parameters.rs2
3 files changed, 31 insertions, 20 deletions
diff --git a/benchmarks2d/all_benchmarks2.rs b/benchmarks2d/all_benchmarks2.rs
index af71049..64ec802 100644
--- a/benchmarks2d/all_benchmarks2.rs
+++ b/benchmarks2d/all_benchmarks2.rs
@@ -58,7 +58,7 @@ pub fn main() {
("Convex polygons", convex_polygons2::init_world),
("Heightfield", heightfield2::init_world),
("Pyramid", pyramid2::init_world),
- ("Verticals tacks", vertical_stacks2::init_world),
+ ("Verticals stacks", vertical_stacks2::init_world),
("(Stress test) joint ball", joint_ball2::init_world),
("(Stress test) joint fixed", joint_fixed2::init_world),
(
diff --git a/benchmarks2d/vertical_stacks2.rs b/benchmarks2d/vertical_stacks2.rs
index 12de83a..a415693 100644
--- a/benchmarks2d/vertical_stacks2.rs
+++ b/benchmarks2d/vertical_stacks2.rs
@@ -10,10 +10,14 @@ pub fn init_world(testbed: &mut Testbed) {
let impulse_joints = ImpulseJointSet::new();
let multibody_joints = MultibodyJointSet::new();
+
+ let num = 40;
+ let rad = 50.0 / 2.0; // 0.5;
+
/*
* Ground
*/
- let ground_size = 100.0;
+ let ground_size = num as f32 * rad * 10.0;
let ground_thickness = 1.0;
let rigid_body = RigidBodyBuilder::fixed();
@@ -24,24 +28,29 @@ pub fn init_world(testbed: &mut Testbed) {
/*
* Create the cubes
*/
- let num = 30;
- let rad = 0.5;
-
- let shift = rad * 2.0;
- let centery = shift / 2.0 + ground_thickness;
-
- for i in 0..num {
- for j in 0usize..1 + i * 2 {
- let fj = j as f32;
- let fi = i as f32;
- let x = (fj - fi) * shift; // (shift + rad / 2.0);
- let y = (num as f32 - fi - 1.0) * shift + centery;
-
- // Build the rigid body.
- let rigid_body = RigidBodyBuilder::dynamic().translation(vector![x, y]);
- let handle = bodies.insert(rigid_body);
- let collider = ColliderBuilder::cuboid(rad, rad);
- colliders.insert_with_parent(collider, handle, &mut bodies);
+
+ let shiftx_centerx = [
+ (rad * 2.0, -(num as f32) * rad * 2.0 * 1.5),
+ (rad * 2.0 + rad, num as f32 * rad * 2.0 * 1.5),
+ ];
+
+ for (shiftx, centerx) in shiftx_centerx {
+ let shifty = rad * 2.0;
+ let centery = shifty / 2.0 + ground_thickness;
+
+ for i in 0..num {
+ for j in 0usize..1 + i * 2 {
+ let fj = j as f32;
+ let fi = i as f32;
+ let x = (fj - fi) * shiftx + centerx;
+ let y = (num as f32 - fi - 1.0) * shifty + centery;
+
+ // Build the rigid body.
+ let rigid_body = RigidBodyBuilder::dynamic().translation(vector![x, y]);
+ let handle = bodies.insert(rigid_body);
+ let collider = ColliderBuilder::cuboid(rad, rad);
+ colliders.insert_with_parent(collider, handle, &mut bodies);
+ }
}
}
diff --git a/src/dynamics/integration_parameters.rs b/src/dynamics/integration_parameters.rs
index 2788349..093ebe9 100644
--- a/src/dynamics/integration_parameters.rs
+++ b/src/dynamics/integration_parameters.rs
@@ -1,6 +1,8 @@
use crate::math::Real;
use std::num::NonZeroUsize;
+// TODO: enabling the block solver in 3d introduces a lot of jitters in
+// the 3D domino demo. So for now we dont enable it in 3D.
pub(crate) static BLOCK_SOLVER_ENABLED: bool = cfg!(feature = "dim2");
pub(crate) static DISABLE_FRICTION_LIMIT_REAPPLY: bool = false;