diff --git a/CHANGELOG.md b/CHANGELOG.md index a46d922..1c9d8fe 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ - `RigidsBody::apply_force`, `::apply_torque`, `::apply_force_at_point` have been renamed to `::add_force`, `::add_torque`, and `::add_force_at_point` to better reflect the fact that they are not cleared at the end of the timestep. +- Rename `RigidBodyType::Static` to `RigidBodyType::Fixed` to avoid confusion with the `static` keyword. +- All method referring to `static` rigid-bodies now use `fixed` instead of `static`. +- Rename `RigidBodyBuilder::new_static, new_kinematic_velocity_based, new_kinematic_velocity_based` to + `RigidBodyBuilder::fixed, kinematic_velocity_based, kinematic_velocity_based`. ## v0.12.0-alpha.0 (2 Jan. 2022) ### Fixed diff --git a/benchmarks2d/balls2.rs b/benchmarks2d/balls2.rs index a560d65..eb0b390 100644 --- a/benchmarks2d/balls2.rs +++ b/benchmarks2d/balls2.rs @@ -42,7 +42,7 @@ pub fn init_world(testbed: &mut Testbed) { let y = j as f32 * shifty + centery; let status = if j == 0 { - RigidBodyType::Static + RigidBodyType::Fixed } else { RigidBodyType::Dynamic }; diff --git a/benchmarks2d/boxes2.rs b/benchmarks2d/boxes2.rs index 0da76a9..2960e70 100644 --- a/benchmarks2d/boxes2.rs +++ b/benchmarks2d/boxes2.rs @@ -15,19 +15,19 @@ pub fn init_world(testbed: &mut Testbed) { */ let ground_size = 25.0; - let rigid_body = RigidBodyBuilder::new_static(); + let rigid_body = RigidBodyBuilder::fixed(); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size, 1.2); colliders.insert_with_parent(collider, handle, &mut bodies); - let rigid_body = RigidBodyBuilder::new_static() + let rigid_body = RigidBodyBuilder::fixed() .rotation(std::f32::consts::FRAC_PI_2) .translation(vector![ground_size, ground_size * 2.0]); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size * 2.0, 1.2); colliders.insert_with_parent(collider, handle, &mut bodies); - let rigid_body = RigidBodyBuilder::new_static() + let rigid_body = RigidBodyBuilder::fixed() .rotation(std::f32::consts::FRAC_PI_2) .translation(vector![-ground_size, ground_size * 2.0]); let handle = bodies.insert(rigid_body); @@ -50,7 +50,7 @@ pub fn init_world(testbed: &mut Testbed) { let y = j as f32 * shift + centery + 2.0; // Build the rigid body. - let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![x, y]); + 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/benchmarks2d/capsules2.rs b/benchmarks2d/capsules2.rs index 86e1004..e4c2efa 100644 --- a/benchmarks2d/capsules2.rs +++ b/benchmarks2d/capsules2.rs @@ -15,19 +15,19 @@ pub fn init_world(testbed: &mut Testbed) { */ let ground_size = 25.0; - let rigid_body = RigidBodyBuilder::new_static(); + let rigid_body = RigidBodyBuilder::fixed(); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size, 1.2); colliders.insert_with_parent(collider, handle, &mut bodies); - let rigid_body = RigidBodyBuilder::new_static() + let rigid_body = RigidBodyBuilder::fixed() .rotation(std::f32::consts::FRAC_PI_2) .translation(vector![ground_size, ground_size * 4.0]); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size * 4.0, 1.2); colliders.insert_with_parent(collider, handle, &mut bodies); - let rigid_body = RigidBodyBuilder::new_static() + let rigid_body = RigidBodyBuilder::fixed() .rotation(std::f32::consts::FRAC_PI_2) .translation(vector![-ground_size, ground_size * 4.0]); let handle = bodies.insert(rigid_body); @@ -52,7 +52,7 @@ pub fn init_world(testbed: &mut Testbed) { let y = j as f32 * shifty + centery + 3.0; // Build the rigid body. - let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![x, y]); + let rigid_body = RigidBodyBuilder::dynamic().translation(vector![x, y]); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::capsule_y(rad * 1.5, rad); colliders.insert_with_parent(collider, handle, &mut bodies); diff --git a/benchmarks2d/convex_polygons2.rs b/benchmarks2d/convex_polygons2.rs index c340143..eaa609c 100644 --- a/benchmarks2d/convex_polygons2.rs +++ b/benchmarks2d/convex_polygons2.rs @@ -17,19 +17,19 @@ pub fn init_world(testbed: &mut Testbed) { */ let ground_size = 30.0; - let rigid_body = RigidBodyBuilder::new_static(); + let rigid_body = RigidBodyBuilder::fixed(); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size, 1.2); colliders.insert_with_parent(collider, handle, &mut bodies); - let rigid_body = RigidBodyBuilder::new_static() + let rigid_body = RigidBodyBuilder::fixed() .rotation(std::f32::consts::FRAC_PI_2) .translation(vector![ground_size, ground_size * 2.0]); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size * 2.0, 1.2); colliders.insert_with_parent(collider, handle, &mut bodies); - let rigid_body = RigidBodyBuilder::new_static() + let rigid_body = RigidBodyBuilder::fixed() .rotation(std::f32::consts::FRAC_PI_2) .translation(vector![-ground_size, ground_size * 2.0]); let handle = bodies.insert(rigid_body); @@ -55,7 +55,7 @@ pub fn init_world(testbed: &mut Testbed) { let x = i as f32 * shift - centerx; let y = j as f32 * shift * 2.0 + centery + 2.0; - let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![x, y]); + let rigid_body = RigidBodyBuilder::dynamic().translation(vector![x, y]); let handle = bodies.insert(rigid_body); let mut points = Vec::new(); diff --git a/benchmarks2d/heightfield2.rs b/benchmarks2d/heightfield2.rs index 60fc45f..7984d08 100644 --- a/benchmarks2d/heightfield2.rs +++ b/benchmarks2d/heightfield2.rs @@ -25,7 +25,7 @@ pub fn init_world(testbed: &mut Testbed) { } }); - let rigid_body = RigidBodyBuilder::new_static(); + let rigid_body = RigidBodyBuilder::fixed(); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::heightfield(heights, ground_size); colliders.insert_with_parent(collider, handle, &mut bodies); @@ -46,7 +46,7 @@ pub fn init_world(testbed: &mut Testbed) { let y = j as f32 * shift + centery + 3.0; // Build the rigid body. - let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![x, y]); + let rigid_body = RigidBodyBuilder::dynamic().translation(vector![x, y]); let handle = bodies.insert(rigid_body); if j % 2 == 0 { diff --git a/benchmarks2d/joint_ball2.rs b/benchmarks2d/joint_ball2.rs index 9d819fc..9fd61ff 100644 --- a/benchmarks2d/joint_ball2.rs +++ b/benchmarks2d/joint_ball2.rs @@ -27,7 +27,7 @@ pub fn init_world(testbed: &mut Testbed) { let fi = i as f32; let status = if k >= numk / 2 - 3 && k <= numk / 2 + 3 && i == 0 { - RigidBodyType::Static + RigidBodyType::Fixed } else { RigidBodyType::Dynamic }; diff --git a/benchmarks2d/joint_fixed2.rs b/benchmarks2d/joint_fixed2.rs index f492bd5..36ff62e 100644 --- a/benchmarks2d/joint_fixed2.rs +++ b/benchmarks2d/joint_fixed2.rs @@ -32,7 +32,7 @@ pub fn init_world(testbed: &mut Testbed) { let fi = i as f32; let status = if k == 0 { - RigidBodyType::Static + RigidBodyType::Fixed } else { RigidBodyType::Dynamic }; diff --git a/benchmarks2d/joint_prismatic2.rs b/benchmarks2d/joint_prismatic2.rs index 65e7fe1..d4d328b 100644 --- a/benchmarks2d/joint_prismatic2.rs +++ b/benchmarks2d/joint_prismatic2.rs @@ -24,7 +24,7 @@ pub fn init_world(testbed: &mut Testbed) { for j in 0..50 { let x = j as f32 * shift * 4.0; - let ground = RigidBodyBuilder::new_static().translation(vector![x, y]); + let ground = RigidBodyBuilder::fixed().translation(vector![x, y]); let mut curr_parent = bodies.insert(ground); let collider = ColliderBuilder::cuboid(rad, rad); colliders.insert_with_parent(collider, curr_parent, &mut bodies); @@ -32,7 +32,7 @@ pub fn init_world(testbed: &mut Testbed) { for i in 0..num { let y = y - (i + 1) as f32 * shift; let density = 1.0; - let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![x, y]); + let rigid_body = RigidBodyBuilder::dynamic().translation(vector![x, y]); let curr_child = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(rad, rad).density(density); colliders.insert_with_parent(collider, curr_child, &mut bodies); diff --git a/benchmarks2d/pyramid2.rs b/benchmarks2d/pyramid2.rs index 7453344..617da83 100644 --- a/benchmarks2d/pyramid2.rs +++ b/benchmarks2d/pyramid2.rs @@ -16,7 +16,7 @@ pub fn init_world(testbed: &mut Testbed) { let ground_size = 100.0; let ground_thickness = 1.0; - let rigid_body = RigidBodyBuilder::new_static(); + let rigid_body = RigidBodyBuilder::fixed(); let ground_handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size, ground_thickness); colliders.insert_with_parent(collider, ground_handle, &mut bodies); @@ -39,7 +39,7 @@ pub fn init_world(testbed: &mut Testbed) { let y = fi * shift + centery; // Build the rigid body. - let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![x, y]); + 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/benchmarks3d/balls3.rs b/benchmarks3d/balls3.rs index 4ccf594..7d76dcf 100644 --- a/benchmarks3d/balls3.rs +++ b/benchmarks3d/balls3.rs @@ -29,7 +29,7 @@ pub fn init_world(testbed: &mut Testbed) { let z = k as f32 * shift - centerz; let status = if j == 0 { - RigidBodyType::Static + RigidBodyType::Fixed } else { RigidBodyType::Dynamic }; diff --git a/benchmarks3d/boxes3.rs b/benchmarks3d/boxes3.rs index e816a63..0981395 100644 --- a/benchmarks3d/boxes3.rs +++ b/benchmarks3d/boxes3.rs @@ -16,7 +16,7 @@ pub fn init_world(testbed: &mut Testbed) { let ground_size = 200.1; let ground_height = 0.1; - let rigid_body = RigidBodyBuilder::new_static().translation(vector![0.0, -ground_height, 0.0]); + let rigid_body = RigidBodyBuilder::fixed().translation(vector![0.0, -ground_height, 0.0]); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size, ground_height, ground_size); colliders.insert_with_parent(collider, handle, &mut bodies); @@ -42,7 +42,7 @@ pub fn init_world(testbed: &mut Testbed) { let z = k as f32 * shift - centerz + offset; // Build the rigid body. - let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![x, y, z]); + let rigid_body = RigidBodyBuilder::dynamic().translation(vector![x, y, z]); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(rad, rad, rad); colliders.insert_with_parent(collider, handle, &mut bodies); diff --git a/benchmarks3d/capsules3.rs b/benchmarks3d/capsules3.rs index ec00e2d..041715e 100644 --- a/benchmarks3d/capsules3.rs +++ b/benchmarks3d/capsules3.rs @@ -16,7 +16,7 @@ pub fn init_world(testbed: &mut Testbed) { let ground_size = 200.1; let ground_height = 0.1; - let rigid_body = RigidBodyBuilder::new_static().translation(vector![0.0, -ground_height, 0.0]); + let rigid_body = RigidBodyBuilder::fixed().translation(vector![0.0, -ground_height, 0.0]); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size, ground_height, ground_size); colliders.insert_with_parent(collider, handle, &mut bodies); @@ -43,7 +43,7 @@ pub fn init_world(testbed: &mut Testbed) { let z = k as f32 * shift - centerz + offset; // Build the rigid body. - let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![x, y, z]); + let rigid_body = RigidBodyBuilder::dynamic().translation(vector![x, y, z]); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::capsule_y(rad, rad); colliders.insert_with_parent(collider, handle, &mut bodies); diff --git a/benchmarks3d/ccd3.rs b/benchmarks3d/ccd3.rs index ed137a2..f642739 100644 --- a/benchmarks3d/ccd3.rs +++ b/benchmarks3d/ccd3.rs @@ -16,7 +16,7 @@ pub fn init_world(testbed: &mut Testbed) { let ground_size = 100.1; let ground_height = 0.1; - let rigid_body = RigidBodyBuilder::new_static().translation(vector![0.0, -ground_height, 0.0]); + let rigid_body = RigidBodyBuilder::fixed().translation(vector![0.0, -ground_height, 0.0]); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size, ground_height, ground_size); colliders.insert_with_parent(collider, handle, &mut bodies); @@ -45,7 +45,7 @@ pub fn init_world(testbed: &mut Testbed) { let z = k as f32 * shiftz - centerz + offset; // Build the rigid body. - let rigid_body = RigidBodyBuilder::new_dynamic() + let rigid_body = RigidBodyBuilder::dynamic() .translation(vector![x, y, z]) .linvel(vector![0.0, -1000.0, 0.0]) .ccd_enabled(true); diff --git a/benchmarks3d/compound3.rs b/benchmarks3d/compound3.rs index 04e8c78..9be2cc5 100644 --- a/benchmarks3d/compound3.rs +++ b/benchmarks3d/compound3.rs @@ -16,7 +16,7 @@ pub fn init_world(testbed: &mut Testbed) { let ground_size = 200.1; let ground_height = 0.1; - let rigid_body = RigidBodyBuilder::new_static().translation(vector![0.0, -ground_height, 0.0]); + let rigid_body = RigidBodyBuilder::fixed().translation(vector![0.0, -ground_height, 0.0]); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size, ground_height, ground_size); colliders.insert_with_parent(collider, handle, &mut bodies); @@ -42,7 +42,7 @@ pub fn init_world(testbed: &mut Testbed) { let z = k as f32 * shift * 2.0 - centerz + offset; // Build the rigid body. - let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![x, y, z]); + let rigid_body = RigidBodyBuilder::dynamic().translation(vector![x, y, z]); let handle = bodies.insert(rigid_body); let collider1 = ColliderBuilder::cuboid(rad * 10.0, rad, rad); let collider2 = ColliderBuilder::cuboid(rad, rad * 10.0, rad).translation(vector![ diff --git a/benchmarks3d/convex_polyhedron3.rs b/benchmarks3d/convex_polyhedron3.rs index 5d9f363..f95c350 100644 --- a/benchmarks3d/convex_polyhedron3.rs +++ b/benchmarks3d/convex_polyhedron3.rs @@ -18,7 +18,7 @@ pub fn init_world(testbed: &mut Testbed) { let ground_size = 200.1; let ground_height = 0.1; - let rigid_body = RigidBodyBuilder::new_static().translation(vector![0.0, -ground_height, 0.0]); + let rigid_body = RigidBodyBuilder::fixed().translation(vector![0.0, -ground_height, 0.0]); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size, ground_height, ground_size); colliders.insert_with_parent(collider, handle, &mut bodies); @@ -55,7 +55,7 @@ pub fn init_world(testbed: &mut Testbed) { } // Build the rigid body. - let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![x, y, z]); + let rigid_body = RigidBodyBuilder::dynamic().translation(vector![x, y, z]); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::round_convex_hull(&points, border_rad).unwrap(); colliders.insert_with_parent(collider, handle, &mut bodies); diff --git a/benchmarks3d/heightfield3.rs b/benchmarks3d/heightfield3.rs index 6bf6fc0..5c392a2 100644 --- a/benchmarks3d/heightfield3.rs +++ b/benchmarks3d/heightfield3.rs @@ -31,7 +31,7 @@ pub fn init_world(testbed: &mut Testbed) { } }); - let rigid_body = RigidBodyBuilder::new_static(); + let rigid_body = RigidBodyBuilder::fixed(); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::heightfield(heights, ground_size); colliders.insert_with_parent(collider, handle, &mut bodies); @@ -55,7 +55,7 @@ pub fn init_world(testbed: &mut Testbed) { let z = k as f32 * shift - centerz; // Build the rigid body. - let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![x, y, z]); + let rigid_body = RigidBodyBuilder::dynamic().translation(vector![x, y, z]); let handle = bodies.insert(rigid_body); if j % 2 == 0 { diff --git a/benchmarks3d/joint_ball3.rs b/benchmarks3d/joint_ball3.rs index 4b509af..f137c69 100644 --- a/benchmarks3d/joint_ball3.rs +++ b/benchmarks3d/joint_ball3.rs @@ -22,7 +22,7 @@ pub fn init_world(testbed: &mut Testbed) { let fi = i as f32; let status = if i == 0 && (k % 4 == 0 || k == num - 1) { - RigidBodyType::Static + RigidBodyType::Fixed } else { RigidBodyType::Dynamic }; diff --git a/benchmarks3d/joint_fixed3.rs b/benchmarks3d/joint_fixed3.rs index 5fdba9c..b15515c 100644 --- a/benchmarks3d/joint_fixed3.rs +++ b/benchmarks3d/joint_fixed3.rs @@ -35,7 +35,7 @@ pub fn init_world(testbed: &mut Testbed) { // a joint between these. let status = if i == 0 && (k % 4 == 0 && k != num - 2 || k == num - 1) { - RigidBodyType::Static + RigidBodyType::Fixed } else { RigidBodyType::Dynamic }; diff --git a/benchmarks3d/joint_prismatic3.rs b/benchmarks3d/joint_prismatic3.rs index faa5f93..a97dc56 100644 --- a/benchmarks3d/joint_prismatic3.rs +++ b/benchmarks3d/joint_prismatic3.rs @@ -23,7 +23,7 @@ pub fn init_world(testbed: &mut Testbed) { for j in 0..50 { let x = j as f32 * shift * 4.0; - let ground = RigidBodyBuilder::new_static().translation(vector![x, y, z]); + let ground = RigidBodyBuilder::fixed().translation(vector![x, y, z]); let mut curr_parent = bodies.insert(ground); let collider = ColliderBuilder::cuboid(rad, rad, rad); colliders.insert_with_parent(collider, curr_parent, &mut bodies); @@ -31,7 +31,7 @@ pub fn init_world(testbed: &mut Testbed) { for i in 0..num { let z = z + (i + 1) as f32 * shift; let density = 1.0; - let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![x, y, z]); + let rigid_body = RigidBodyBuilder::dynamic().translation(vector![x, y, z]); let curr_child = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(rad, rad, rad).density(density); colliders.insert_with_parent(collider, curr_child, &mut bodies); diff --git a/benchmarks3d/joint_revolute3.rs b/benchmarks3d/joint_revolute3.rs index aa1be50..779248a 100644 --- a/benchmarks3d/joint_revolute3.rs +++ b/benchmarks3d/joint_revolute3.rs @@ -20,7 +20,7 @@ pub fn init_world(testbed: &mut Testbed) { for j in 0..50 { let x = j as f32 * shift * 4.0; - let ground = RigidBodyBuilder::new_static().translation(vector![x, y, 0.0]); + let ground = RigidBodyBuilder::fixed().translation(vector![x, y, 0.0]); let mut curr_parent = bodies.insert(ground); let collider = ColliderBuilder::cuboid(rad, rad, rad); colliders.insert_with_parent(collider, curr_parent, &mut bodies); @@ -38,7 +38,7 @@ pub fn init_world(testbed: &mut Testbed) { let mut handles = [curr_parent; 4]; for k in 0..4 { let density = 1.0; - let rigid_body = RigidBodyBuilder::new_dynamic().position(positions[k]); + let rigid_body = RigidBodyBuilder::dynamic().position(positions[k]); handles[k] = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(rad, rad, rad).density(density); colliders.insert_with_parent(collider, handles[k], &mut bodies); diff --git a/benchmarks3d/keva3.rs b/benchmarks3d/keva3.rs index 30e5246..ecd6e77 100644 --- a/benchmarks3d/keva3.rs +++ b/benchmarks3d/keva3.rs @@ -38,7 +38,7 @@ pub fn build_block( }; // Build the rigid body. - let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![ + let rigid_body = RigidBodyBuilder::dynamic().translation(vector![ x + dim.x + shift.x, y + dim.y + shift.y, z + dim.z + shift.z @@ -59,7 +59,7 @@ pub fn build_block( for i in 0..(block_width / (dim.x as f32 * 2.0)) as usize { for j in 0..(block_width / (dim.z as f32 * 2.0)) as usize { // Build the rigid body. - let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![ + let rigid_body = RigidBodyBuilder::dynamic().translation(vector![ i as f32 * dim.x * 2.0 + dim.x + shift.x, dim.y + shift.y + block_height, j as f32 * dim.z * 2.0 + dim.z + shift.z @@ -88,7 +88,7 @@ pub fn init_world(testbed: &mut Testbed) { let ground_size = 50.0; let ground_height = 0.1; - let rigid_body = RigidBodyBuilder::new_static().translation(vector![0.0, -ground_height, 0.0]); + let rigid_body = RigidBodyBuilder::fixed().translation(vector![0.0, -ground_height, 0.0]); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size, ground_height, ground_size); colliders.insert_with_parent(collider, handle, &mut bodies); diff --git a/benchmarks3d/pyramid3.rs b/benchmarks3d/pyramid3.rs index 572db45..fbbce31 100644 --- a/benchmarks3d/pyramid3.rs +++ b/benchmarks3d/pyramid3.rs @@ -22,7 +22,7 @@ fn create_pyramid( - stack_height as f32 * half_extents.z; // Build the rigid body. - let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![x, y, z]); + let rigid_body = RigidBodyBuilder::dynamic().translation(vector![x, y, z]); let rigid_body_handle = bodies.insert(rigid_body); let collider = @@ -48,7 +48,7 @@ pub fn init_world(testbed: &mut Testbed) { let ground_size = 50.0; let ground_height = 0.1; - let rigid_body = RigidBodyBuilder::new_static().translation(vector![0.0, -ground_height, 0.0]); + let rigid_body = RigidBodyBuilder::fixed().translation(vector![0.0, -ground_height, 0.0]); let ground_handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size, ground_height, ground_size); colliders.insert_with_parent(collider, ground_handle, &mut bodies); diff --git a/benchmarks3d/stacks3.rs b/benchmarks3d/stacks3.rs index ff67917..15fa17c 100644 --- a/benchmarks3d/stacks3.rs +++ b/benchmarks3d/stacks3.rs @@ -23,7 +23,7 @@ fn create_tower_circle( * Translation::new(0.0, y, radius); // Build the rigid body. - let rigid_body = RigidBodyBuilder::new_dynamic().position(pos); + let rigid_body = RigidBodyBuilder::dynamic().position(pos); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(half_extents.x, half_extents.y, half_extents.z); colliders.insert_with_parent(collider, handle, bodies); @@ -49,7 +49,7 @@ fn create_wall( - stack_height as f32 * half_extents.z; // Build the rigid body. - let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![x, y, z]); + let rigid_body = RigidBodyBuilder::dynamic().translation(vector![x, y, z]); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(half_extents.x, half_extents.y, half_extents.z); colliders.insert_with_parent(collider, handle, bodies); @@ -79,7 +79,7 @@ fn create_pyramid( - stack_height as f32 * half_extents.z; // Build the rigid body. - let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![x, y, z]); + let rigid_body = RigidBodyBuilder::dynamic().translation(vector![x, y, z]); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(half_extents.x, half_extents.y, half_extents.z); @@ -104,7 +104,7 @@ pub fn init_world(testbed: &mut Testbed) { let ground_size = 200.0; let ground_height = 0.1; - let rigid_body = RigidBodyBuilder::new_static().translation(vector![0.0, -ground_height, 0.0]); + let rigid_body = RigidBodyBuilder::fixed().translation(vector![0.0, -ground_height, 0.0]); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size, ground_height, ground_size); colliders.insert_with_parent(collider, handle, &mut bodies); diff --git a/benchmarks3d/trimesh3.rs b/benchmarks3d/trimesh3.rs index e9d73ee..ea5aaaa 100644 --- a/benchmarks3d/trimesh3.rs +++ b/benchmarks3d/trimesh3.rs @@ -36,7 +36,7 @@ pub fn init_world(testbed: &mut Testbed) { let heightfield = HeightField::new(heights, ground_size); let (vertices, indices) = heightfield.to_trimesh(); - let rigid_body = RigidBodyBuilder::new_static(); + let rigid_body = RigidBodyBuilder::fixed(); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::trimesh(vertices, indices); colliders.insert_with_parent(collider, handle, &mut bodies); @@ -60,7 +60,7 @@ pub fn init_world(testbed: &mut Testbed) { let z = k as f32 * shift - centerz; // Build the rigid body. - let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![x, y, z]); + let rigid_body = RigidBodyBuilder::dynamic().translation(vector![x, y, z]); let handle = bodies.insert(rigid_body); if j % 2 == 0 { diff --git a/examples2d/add_remove2.rs b/examples2d/add_remove2.rs index 261071b..1405b51 100644 --- a/examples2d/add_remove2.rs +++ b/examples2d/add_remove2.rs @@ -14,7 +14,7 @@ pub fn init_world(testbed: &mut Testbed) { let platform_handles = positions .into_iter() .map(|pos| { - let rigid_body = RigidBodyBuilder::new_kinematic_position_based().translation(pos); + let rigid_body = RigidBodyBuilder::kinematic_position_based().translation(pos); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(rad * 10.0, rad); colliders.insert_with_parent(collider, handle, &mut bodies); @@ -33,7 +33,7 @@ pub fn init_world(testbed: &mut Testbed) { if state.timestep_id % 10 == 0 { let x = rand::random::() * 10.0 - 5.0; let y = rand::random::() * 10.0 + 10.0; - let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![x, y]); + let rigid_body = RigidBodyBuilder::dynamic().translation(vector![x, y]); let handle = physics.bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(rad, rad); physics diff --git a/examples2d/ccd2.rs b/examples2d/ccd2.rs index 0e64713..0a10800 100644 --- a/examples2d/ccd2.rs +++ b/examples2d/ccd2.rs @@ -16,7 +16,7 @@ pub fn init_world(testbed: &mut Testbed) { let ground_size = 25.0; let ground_thickness = 0.1; - let rigid_body = RigidBodyBuilder::new_static().ccd_enabled(true); + let rigid_body = RigidBodyBuilder::fixed().ccd_enabled(true); let ground_handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size, ground_thickness); @@ -66,7 +66,7 @@ pub fn init_world(testbed: &mut Testbed) { let y = j as f32 * shift + centery; // Build the rigid body. - let rigid_body = RigidBodyBuilder::new_dynamic() + let rigid_body = RigidBodyBuilder::dynamic() .translation(vector![x, y]) .linvel(vector![100.0, -10.0]) .ccd_enabled(true); diff --git a/examples2d/collision_groups2.rs b/examples2d/collision_groups2.rs index 9c9cd30..707696c 100644 --- a/examples2d/collision_groups2.rs +++ b/examples2d/collision_groups2.rs @@ -16,7 +16,7 @@ pub fn init_world(testbed: &mut Testbed) { let ground_size = 5.0; let ground_height = 0.1; - let rigid_body = RigidBodyBuilder::new_static().translation(vector![0.0, -ground_height]); + let rigid_body = RigidBodyBuilder::fixed().translation(vector![0.0, -ground_height]); let floor_handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size, ground_height); colliders.insert_with_parent(collider, floor_handle, &mut bodies); @@ -70,7 +70,7 @@ pub fn init_world(testbed: &mut Testbed) { (BLUE_GROUP, [0.0, 0.0, 1.0]) }; - let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![x, y]); + let rigid_body = RigidBodyBuilder::dynamic().translation(vector![x, y]); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(rad, rad).collision_groups(group); colliders.insert_with_parent(collider, handle, &mut bodies); diff --git a/examples2d/convex_polygons2.rs b/examples2d/convex_polygons2.rs index b3139c4..b986d6a 100644 --- a/examples2d/convex_polygons2.rs +++ b/examples2d/convex_polygons2.rs @@ -17,19 +17,19 @@ pub fn init_world(testbed: &mut Testbed) { */ let ground_size = 30.0; - let rigid_body = RigidBodyBuilder::new_static(); + let rigid_body = RigidBodyBuilder::fixed(); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size, 1.2); colliders.insert_with_parent(collider, handle, &mut bodies); - let rigid_body = RigidBodyBuilder::new_static() + let rigid_body = RigidBodyBuilder::fixed() .rotation(std::f32::consts::FRAC_PI_2) .translation(vector![ground_size, ground_size * 2.0]); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size * 2.0, 1.2); colliders.insert_with_parent(collider, handle, &mut bodies); - let rigid_body = RigidBodyBuilder::new_static() + let rigid_body = RigidBodyBuilder::fixed() .rotation(std::f32::consts::FRAC_PI_2) .translation(vector![-ground_size, ground_size * 2.0]); let handle = bodies.insert(rigid_body); @@ -55,7 +55,7 @@ pub fn init_world(testbed: &mut Testbed) { let x = i as f32 * shift - centerx; let y = j as f32 * shift * 2.0 + centery + 2.0; - let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![x, y]); + let rigid_body = RigidBodyBuilder::dynamic().translation(vector![x, y]); let handle = bodies.insert(rigid_body); let mut points = Vec::new(); diff --git a/examples2d/damping2.rs b/examples2d/damping2.rs index 689190c..0087323 100644 --- a/examples2d/damping2.rs +++ b/examples2d/damping2.rs @@ -22,7 +22,7 @@ pub fn init_world(testbed: &mut Testbed) { let (x, y) = (i as f32 * subdiv * std::f32::consts::PI * 2.0).sin_cos(); // Build the rigid body. - let rb = RigidBodyBuilder::new_dynamic() + let rb = RigidBodyBuilder::dynamic() .translation(vector![x, y]) .linvel(vector![x * 10.0, y * 10.0]) .angvel(100.0) diff --git a/examples2d/debug_box_ball2.rs b/examples2d/debug_box_ball2.rs index e071c61..9725ccf 100644 --- a/examples2d/debug_box_ball2.rs +++ b/examples2d/debug_box_ball2.rs @@ -14,7 +14,7 @@ pub fn init_world(testbed: &mut Testbed) { * Ground */ let rad = 1.0; - let rigid_body = RigidBodyBuilder::new_static() + let rigid_body = RigidBodyBuilder::fixed() .translation(vector![0.0, -rad]) .rotation(std::f32::consts::PI / 4.0); let handle = bodies.insert(rigid_body); @@ -22,7 +22,7 @@ pub fn init_world(testbed: &mut Testbed) { colliders.insert_with_parent(collider, handle, &mut bodies); // Build the dynamic box rigid body. - let rigid_body = RigidBodyBuilder::new_dynamic() + let rigid_body = RigidBodyBuilder::dynamic() .translation(vector![0.0, 3.0 * rad]) .can_sleep(false); let handle = bodies.insert(rigid_body); diff --git a/examples2d/drum2.rs b/examples2d/drum2.rs index 57c891f..54588c8 100644 --- a/examples2d/drum2.rs +++ b/examples2d/drum2.rs @@ -26,7 +26,7 @@ pub fn init_world(testbed: &mut Testbed) { let y = j as f32 * shift - centery; // Build the rigid body. - let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![x, y]); + 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); @@ -36,7 +36,7 @@ pub fn init_world(testbed: &mut Testbed) { /* * Setup a velocity-based kinematic rigid body. */ - let platform_body = RigidBodyBuilder::new_kinematic_velocity_based(); + let platform_body = RigidBodyBuilder::kinematic_velocity_based(); let velocity_based_platform_handle = bodies.insert(platform_body); let sides = [ diff --git a/examples2d/heightfield2.rs b/examples2d/heightfield2.rs index 65ad76c..56ffc9f 100644 --- a/examples2d/heightfield2.rs +++ b/examples2d/heightfield2.rs @@ -25,7 +25,7 @@ pub fn init_world(testbed: &mut Testbed) { } }); - let rigid_body = RigidBodyBuilder::new_static(); + let rigid_body = RigidBodyBuilder::fixed(); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::heightfield(heights, ground_size); colliders.insert_with_parent(collider, handle, &mut bodies); @@ -46,7 +46,7 @@ pub fn init_world(testbed: &mut Testbed) { let y = j as f32 * shift + centery + 3.0; // Build the rigid body. - let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![x, y]); + let rigid_body = RigidBodyBuilder::dynamic().translation(vector![x, y]); let handle = bodies.insert(rigid_body); if j % 2 == 0 { diff --git a/examples2d/joints2.rs b/examples2d/joints2.rs index 7a7119e..31fda33 100644 --- a/examples2d/joints2.rs +++ b/examples2d/joints2.rs @@ -30,7 +30,7 @@ pub fn init_world(testbed: &mut Testbed) { let fi = i as f32; let status = if i == 0 && k == 0 { - RigidBodyType::Static + RigidBodyType::Fixed } else { RigidBodyType::Dynamic }; diff --git a/examples2d/locked_rotations2.rs b/examples2d/locked_rotations2.rs index c9d74be..35b1549 100644 --- a/examples2d/locked_rotations2.rs +++ b/examples2d/locked_rotations2.rs @@ -19,7 +19,7 @@ pub fn init_world(testbed: &mut Testbed) { let ground_size = 5.0; let ground_height = 0.1; - let rigid_body = RigidBodyBuilder::new_static().translation(vector![0.0, -ground_height]); + let rigid_body = RigidBodyBuilder::fixed().translation(vector![0.0, -ground_height]); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size, ground_height); colliders.insert_with_parent(collider, handle, &mut bodies); @@ -27,7 +27,7 @@ pub fn init_world(testbed: &mut Testbed) { /* * A rectangle that only rotate. */ - let rigid_body = RigidBodyBuilder::new_dynamic() + let rigid_body = RigidBodyBuilder::dynamic() .translation(vector![0.0, 3.0]) .lock_translations(); let handle = bodies.insert(rigid_body); @@ -37,7 +37,7 @@ pub fn init_world(testbed: &mut Testbed) { /* * A tilted capsule that cannot rotate. */ - let rigid_body = RigidBodyBuilder::new_dynamic() + let rigid_body = RigidBodyBuilder::dynamic() .translation(vector![0.0, 5.0]) .rotation(1.0) .lock_rotations(); diff --git a/examples2d/one_way_platforms2.rs b/examples2d/one_way_platforms2.rs index dae3f39..2b72c1f 100644 --- a/examples2d/one_way_platforms2.rs +++ b/examples2d/one_way_platforms2.rs @@ -68,7 +68,7 @@ pub fn init_world(testbed: &mut Testbed) { /* * Ground */ - let rigid_body = RigidBodyBuilder::new_static(); + let rigid_body = RigidBodyBuilder::fixed(); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(25.0, 0.5) @@ -96,7 +96,7 @@ pub fn init_world(testbed: &mut Testbed) { if run_state.timestep_id % 50 == 0 && physics.bodies.len() <= 7 { // Spawn a new cube. let collider = ColliderBuilder::cuboid(1.5, 2.0); - let body = RigidBodyBuilder::new_dynamic().translation(vector![20.0, 10.0]); + let body = RigidBodyBuilder::dynamic().translation(vector![20.0, 10.0]); let handle = physics.bodies.insert(body); physics .colliders diff --git a/examples2d/platform2.rs b/examples2d/platform2.rs index 325e7ce..c240518 100644 --- a/examples2d/platform2.rs +++ b/examples2d/platform2.rs @@ -16,7 +16,7 @@ pub fn init_world(testbed: &mut Testbed) { let ground_size = 10.0; let ground_height = 0.1; - let rigid_body = RigidBodyBuilder::new_static().translation(vector![0.0, -ground_height]); + let rigid_body = RigidBodyBuilder::fixed().translation(vector![0.0, -ground_height]); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size, ground_height); colliders.insert_with_parent(collider, handle, &mut bodies); @@ -37,7 +37,7 @@ pub fn init_world(testbed: &mut Testbed) { let y = j as f32 * shift + centery; // Build the rigid body. - let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![x, y]); + 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); @@ -47,8 +47,8 @@ pub fn init_world(testbed: &mut Testbed) { /* * Setup a position-based kinematic rigid body. */ - let platform_body = RigidBodyBuilder::new_kinematic_velocity_based() - .translation(vector![-10.0 * rad, 1.5 + 0.8]); + let platform_body = + RigidBodyBuilder::kinematic_velocity_based().translation(vector![-10.0 * rad, 1.5 + 0.8]); let velocity_based_platform_handle = bodies.insert(platform_body); let collider = ColliderBuilder::cuboid(rad * 10.0, rad); colliders.insert_with_parent(collider, velocity_based_platform_handle, &mut bodies); @@ -56,7 +56,7 @@ pub fn init_world(testbed: &mut Testbed) { /* * Setup a velocity-based kinematic rigid body. */ - let platform_body = RigidBodyBuilder::new_kinematic_position_based() + let platform_body = RigidBodyBuilder::kinematic_position_based() .translation(vector![-10.0 * rad, 2.0 + 1.5 + 0.8]); let position_based_platform_handle = bodies.insert(platform_body); let collider = ColliderBuilder::cuboid(rad * 10.0, rad); diff --git a/examples2d/polyline2.rs b/examples2d/polyline2.rs index 35253e0..d9eb604 100644 --- a/examples2d/polyline2.rs +++ b/examples2d/polyline2.rs @@ -27,7 +27,7 @@ pub fn init_world(testbed: &mut Testbed) { } points.push(point![ground_size / 2.0, 40.0]); - let rigid_body = RigidBodyBuilder::new_static(); + let rigid_body = RigidBodyBuilder::fixed(); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::polyline(points, None); colliders.insert_with_parent(collider, handle, &mut bodies); @@ -48,7 +48,7 @@ pub fn init_world(testbed: &mut Testbed) { let y = j as f32 * shift + centery + 3.0; // Build the rigid body. - let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![x, y]); + let rigid_body = RigidBodyBuilder::dynamic().translation(vector![x, y]); let handle = bodies.insert(rigid_body); if j % 2 == 0 { diff --git a/examples2d/pyramid2.rs b/examples2d/pyramid2.rs index 1f1440c..cc501f4 100644 --- a/examples2d/pyramid2.rs +++ b/examples2d/pyramid2.rs @@ -16,7 +16,7 @@ pub fn init_world(testbed: &mut Testbed) { let ground_size = 10.0; let ground_thickness = 1.0; - let rigid_body = RigidBodyBuilder::new_static(); + let rigid_body = RigidBodyBuilder::fixed(); let ground_handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size, ground_thickness); colliders.insert_with_parent(collider, ground_handle, &mut bodies); @@ -39,7 +39,7 @@ pub fn init_world(testbed: &mut Testbed) { let y = fi * shift + centery; // Build the rigid body. - let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![x, y]); + 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/examples2d/restitution2.rs b/examples2d/restitution2.rs index 428c6c4..273777c 100644 --- a/examples2d/restitution2.rs +++ b/examples2d/restitution2.rs @@ -16,7 +16,7 @@ pub fn init_world(testbed: &mut Testbed) { let ground_size = 20.; let ground_height = 1.0; - let rigid_body = RigidBodyBuilder::new_static().translation(vector![0.0, -ground_height]); + let rigid_body = RigidBodyBuilder::fixed().translation(vector![0.0, -ground_height]); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size, ground_height).restitution(1.0); colliders.insert_with_parent(collider, handle, &mut bodies); @@ -27,8 +27,8 @@ pub fn init_world(testbed: &mut Testbed) { for j in 0..2 { for i in 0..=num { let x = (i as f32) - num as f32 / 2.0; - let rigid_body = RigidBodyBuilder::new_dynamic() - .translation(vector![x * 2.0, 10.0 * (j as f32 + 1.0)]); + let rigid_body = + RigidBodyBuilder::dynamic().translation(vector![x * 2.0, 10.0 * (j as f32 + 1.0)]); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::ball(rad).restitution((i as f32) / (num as f32)); colliders.insert_with_parent(collider, handle, &mut bodies); diff --git a/examples2d/sensor2.rs b/examples2d/sensor2.rs index edd8933..e5a95df 100644 --- a/examples2d/sensor2.rs +++ b/examples2d/sensor2.rs @@ -16,7 +16,7 @@ pub fn init_world(testbed: &mut Testbed) { let ground_size = 200.1; let ground_height = 0.1; - let rigid_body = RigidBodyBuilder::new_static().translation(vector![0.0, -ground_height]); + let rigid_body = RigidBodyBuilder::fixed().translation(vector![0.0, -ground_height]); let ground_handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size, ground_height); colliders.insert_with_parent(collider, ground_handle, &mut bodies); @@ -35,7 +35,7 @@ pub fn init_world(testbed: &mut Testbed) { let y = 3.0; // Build the rigid body. - let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![x, y]); + 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); @@ -48,7 +48,7 @@ pub fn init_world(testbed: &mut Testbed) { */ // Rigid body so that the sensor can move. - let sensor = RigidBodyBuilder::new_dynamic().translation(vector![0.0, 10.0]); + let sensor = RigidBodyBuilder::dynamic().translation(vector![0.0, 10.0]); let sensor_handle = bodies.insert(sensor); // Solid cube attached to the sensor which diff --git a/examples2d/trimesh2.rs b/examples2d/trimesh2.rs index debecf9..219a583 100644 --- a/examples2d/trimesh2.rs +++ b/examples2d/trimesh2.rs @@ -21,19 +21,19 @@ pub fn init_world(testbed: &mut Testbed) { */ let ground_size = 25.0; - let rigid_body = RigidBodyBuilder::new_static(); + let rigid_body = RigidBodyBuilder::fixed(); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size, 1.2); colliders.insert_with_parent(collider, handle, &mut bodies); - let rigid_body = RigidBodyBuilder::new_static() + let rigid_body = RigidBodyBuilder::fixed() .rotation(std::f32::consts::FRAC_PI_2) .translation(vector![ground_size, ground_size]); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size, 1.2); colliders.insert_with_parent(collider, handle, &mut bodies); - let rigid_body = RigidBodyBuilder::new_static() + let rigid_body = RigidBodyBuilder::fixed() .rotation(std::f32::consts::FRAC_PI_2) .translation(vector![-ground_size, ground_size]); let handle = bodies.insert(rigid_body); @@ -85,7 +85,7 @@ pub fn init_world(testbed: &mut Testbed) { for k in 0..5 { let collider = ColliderBuilder::trimesh(vertices.clone(), indices.clone()); - let rigid_body = RigidBodyBuilder::new_dynamic() + let rigid_body = RigidBodyBuilder::dynamic() .translation(vector![ith as f32 * 8.0 - 20.0, 20.0 + k as f32 * 11.0]) .rotation(angle); let handle = bodies.insert(rigid_body); diff --git a/examples3d/ccd3.rs b/examples3d/ccd3.rs index c1ade84..635b0e0 100644 --- a/examples3d/ccd3.rs +++ b/examples3d/ccd3.rs @@ -21,7 +21,7 @@ fn create_wall( - stack_height as f32 * half_extents.z; // Build the rigid body. - let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![x, y, z]); + let rigid_body = RigidBodyBuilder::dynamic().translation(vector![x, y, z]); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(half_extents.x, half_extents.y, half_extents.z); colliders.insert_with_parent(collider, handle, bodies); @@ -50,7 +50,7 @@ pub fn init_world(testbed: &mut Testbed) { let ground_size = 50.0; let ground_height = 0.1; - let rigid_body = RigidBodyBuilder::new_static().translation(vector![0.0, -ground_height, 0.0]); + let rigid_body = RigidBodyBuilder::fixed().translation(vector![0.0, -ground_height, 0.0]); let ground_handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size, ground_height, ground_size); colliders.insert_with_parent(collider, ground_handle, &mut bodies); @@ -93,7 +93,7 @@ pub fn init_world(testbed: &mut Testbed) { .density(10.0) .sensor(true) .active_events(ActiveEvents::INTERSECTION_EVENTS); - let rigid_body = RigidBodyBuilder::new_dynamic() + let rigid_body = RigidBodyBuilder::dynamic() .linvel(vector![1000.0, 0.0, 0.0]) .translation(vector![-20.0, shift_y + 2.0, 0.0]) .ccd_enabled(true); @@ -102,7 +102,7 @@ pub fn init_world(testbed: &mut Testbed) { // Second rigid-body with CCD enabled. let collider = ColliderBuilder::ball(1.0).density(10.0); - let rigid_body = RigidBodyBuilder::new_dynamic() + let rigid_body = RigidBodyBuilder::dynamic() .linvel(vector![1000.0, 0.0, 0.0]) .translation(vector![-20.0, shift_y + 2.0, shift_z]) .ccd_enabled(true); diff --git a/examples3d/collision_groups3.rs b/examples3d/collision_groups3.rs index c1bc144..480ac3e 100644 --- a/examples3d/collision_groups3.rs +++ b/examples3d/collision_groups3.rs @@ -16,7 +16,7 @@ pub fn init_world(testbed: &mut Testbed) { let ground_size = 5.0; let ground_height = 0.1; - let rigid_body = RigidBodyBuilder::new_static().translation(vector![0.0, -ground_height, 0.0]); + let rigid_body = RigidBodyBuilder::fixed().translation(vector![0.0, -ground_height, 0.0]); let floor_handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size, ground_height, ground_size); colliders.insert_with_parent(collider, floor_handle, &mut bodies); @@ -73,7 +73,7 @@ pub fn init_world(testbed: &mut Testbed) { (BLUE_GROUP, [0.0, 0.0, 1.0]) }; - let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![x, y, z]); + let rigid_body = RigidBodyBuilder::dynamic().translation(vector![x, y, z]); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(rad, rad, rad).collision_groups(group); colliders.insert_with_parent(collider, handle, &mut bodies); diff --git a/examples3d/compound3.rs b/examples3d/compound3.rs index 5ecccb9..8c2deb0 100644 --- a/examples3d/compound3.rs +++ b/examples3d/compound3.rs @@ -16,7 +16,7 @@ pub fn init_world(testbed: &mut Testbed) { let ground_size = 50.0; let ground_height = 0.1; - let rigid_body = RigidBodyBuilder::new_static().translation(vector![0.0, -ground_height, 0.0]); + let rigid_body = RigidBodyBuilder::fixed().translation(vector![0.0, -ground_height, 0.0]); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size, ground_height, ground_size); colliders.insert_with_parent(collider, handle, &mut bodies); @@ -43,7 +43,7 @@ pub fn init_world(testbed: &mut Testbed) { let z = k as f32 * shift * 2.0 - centerz + offset; // Build the rigid body. - let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![x, y, z]); + let rigid_body = RigidBodyBuilder::dynamic().translation(vector![x, y, z]); let handle = bodies.insert(rigid_body); // First option: attach several colliders to a single rigid-body. diff --git a/examples3d/convex_decomposition3.rs b/examples3d/convex_decomposition3.rs index 33c1611..0863430 100644 --- a/examples3d/convex_decomposition3.rs +++ b/examples3d/convex_decomposition3.rs @@ -24,7 +24,7 @@ pub fn init_world(testbed: &mut Testbed) { let ground_size = 50.0; let ground_height = 0.1; - let rigid_body = RigidBodyBuilder::new_static().translation(vector![0.0, -ground_height, 0.0]); + let rigid_body = RigidBodyBuilder::fixed().translation(vector![0.0, -ground_height, 0.0]); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size, ground_height, ground_size); colliders.insert_with_parent(collider, handle, &mut bodies); @@ -86,7 +86,7 @@ pub fn init_world(testbed: &mut Testbed) { let y = (igeom / width) as f32 * shift + 4.0; let z = k as f32 * shift; - let body = RigidBodyBuilder::new_dynamic().translation(vector![x, y, z]); + let body = RigidBodyBuilder::dynamic().translation(vector![x, y, z]); let handle = bodies.insert(body); for shape in &shapes { diff --git a/examples3d/convex_polyhedron3.rs b/examples3d/convex_polyhedron3.rs index b4c391e..980720a 100644 --- a/examples3d/convex_polyhedron3.rs +++ b/examples3d/convex_polyhedron3.rs @@ -18,7 +18,7 @@ pub fn init_world(testbed: &mut Testbed) { let ground_size = 40.0; let ground_height = 0.1; - let rigid_body = RigidBodyBuilder::new_static().translation(vector![0.0, -ground_height, 0.0]); + let rigid_body = RigidBodyBuilder::fixed().translation(vector![0.0, -ground_height, 0.0]); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size, ground_height, ground_size); colliders.insert_with_parent(collider, handle, &mut bodies); @@ -52,7 +52,7 @@ pub fn init_world(testbed: &mut Testbed) { } // Build the rigid body. - let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![x, y, z]); + let rigid_body = RigidBodyBuilder::dynamic().translation(vector![x, y, z]); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::round_convex_hull(&points, border_rad).unwrap(); colliders.insert_with_parent(collider, handle, &mut bodies); diff --git a/examples3d/damping3.rs b/examples3d/damping3.rs index d189482..992afbe 100644 --- a/examples3d/damping3.rs +++ b/examples3d/damping3.rs @@ -22,7 +22,7 @@ pub fn init_world(testbed: &mut Testbed) { let (x, y) = (i as f32 * subdiv * std::f32::consts::PI * 2.0).sin_cos(); // Build the rigid body. - let rb = RigidBodyBuilder::new_dynamic() + let rb = RigidBodyBuilder::dynamic() .translation(vector![x, y, 0.0]) .linvel(vector![x * 10.0, y * 10.0, 0.0]) .angvel(Vector::z() * 100.0) diff --git a/examples3d/debug_add_remove_collider3.rs b/examples3d/debug_add_remove_collider3.rs index e6d8ac6..25bb23a 100644 --- a/examples3d/debug_add_remove_collider3.rs +++ b/examples3d/debug_add_remove_collider3.rs @@ -16,7 +16,7 @@ pub fn init_world(testbed: &mut Testbed) { let ground_size = 3.0; let ground_height = 0.1; - let rigid_body = RigidBodyBuilder::new_static().translation(vector![0.0, -ground_height, 0.0]); + let rigid_body = RigidBodyBuilder::fixed().translation(vector![0.0, -ground_height, 0.0]); let ground_handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size, ground_height, 0.4); let mut ground_collider_handle = @@ -26,7 +26,7 @@ pub fn init_world(testbed: &mut Testbed) { * Rolling ball */ let ball_rad = 0.1; - let rb = RigidBodyBuilder::new_dynamic().translation(vector![0.0, 0.2, 0.0]); + let rb = RigidBodyBuilder::dynamic().translation(vector![0.0, 0.2, 0.0]); let ball_handle = bodies.insert(rb); let collider = ColliderBuilder::ball(ball_rad).density(100.0); colliders.insert_with_parent(collider, ball_handle, &mut bodies); diff --git a/examples3d/debug_articulations3.rs b/examples3d/debug_articulations3.rs index 0dbc66a..e844630 100644 --- a/examples3d/debug_articulations3.rs +++ b/examples3d/debug_articulations3.rs @@ -20,7 +20,7 @@ fn create_ball_articulations( let status = if i == 0 { // && (k % 4 == 0 || k == num - 1) { - RigidBodyType::Static + RigidBodyType::Fixed } else { RigidBodyType::Dynamic }; @@ -74,7 +74,7 @@ pub fn init_world(testbed: &mut Testbed) { .rotation(vector![0.1, 0.0, 0.1]); colliders.insert(collider); - let rigid_body = RigidBodyBuilder::new_dynamic(); + let rigid_body = RigidBodyBuilder::dynamic(); let collider = ColliderBuilder::cuboid(30.0, 0.01, 30.0) .translation(vector![0.0, -3.0, 0.0]) .rotation(vector![0.1, 0.0, 0.1]); diff --git a/examples3d/debug_big_colliders3.rs b/examples3d/debug_big_colliders3.rs index d221a05..680e24e 100644 --- a/examples3d/debug_big_colliders3.rs +++ b/examples3d/debug_big_colliders3.rs @@ -13,7 +13,7 @@ pub fn init_world(testbed: &mut Testbed) { /* * Ground */ - let rigid_body = RigidBodyBuilder::new_static(); + let rigid_body = RigidBodyBuilder::fixed(); let handle = bodies.insert(rigid_body); let halfspace = SharedShape::new(HalfSpace::new(Vector::y_axis())); let collider = ColliderBuilder::new(halfspace); @@ -26,7 +26,7 @@ pub fn init_world(testbed: &mut Testbed) { let curr_height = 0.1f32.min(curr_width); curr_y += curr_height * 4.0; - let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![0.0, curr_y, 0.0]); + let rigid_body = RigidBodyBuilder::dynamic().translation(vector![0.0, curr_y, 0.0]); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(curr_width, curr_height, curr_width); colliders.insert_with_parent(collider, handle, &mut bodies); diff --git a/examples3d/debug_boxes3.rs b/examples3d/debug_boxes3.rs index 908985b..1bd1504 100644 --- a/examples3d/debug_boxes3.rs +++ b/examples3d/debug_boxes3.rs @@ -17,8 +17,7 @@ pub fn init_world(testbed: &mut Testbed) { let ground_height = 0.1; for _ in 0..6 { - let rigid_body = - RigidBodyBuilder::new_static().translation(vector![0.0, -ground_height, 0.0]); + let rigid_body = RigidBodyBuilder::fixed().translation(vector![0.0, -ground_height, 0.0]); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size, ground_height, ground_size); colliders.insert_with_parent(collider, handle, &mut bodies); @@ -26,7 +25,7 @@ pub fn init_world(testbed: &mut Testbed) { // Build the dynamic box rigid body. for _ in 0..2 { - let rigid_body = RigidBodyBuilder::new_dynamic() + let rigid_body = RigidBodyBuilder::dynamic() .translation(vector![1.1, 0.0, 0.0]) // .rotation(vector![0.8, 0.2, 0.1]) .can_sleep(false); diff --git a/examples3d/debug_cylinder3.rs b/examples3d/debug_cylinder3.rs index b62fb12..1805aed 100644 --- a/examples3d/debug_cylinder3.rs +++ b/examples3d/debug_cylinder3.rs @@ -19,7 +19,7 @@ pub fn init_world(testbed: &mut Testbed) { let ground_size = 100.1; let ground_height = 0.1; - let rigid_body = RigidBodyBuilder::new_static().translation(vector![0.0, -ground_height, 0.0]); + let rigid_body = RigidBodyBuilder::fixed().translation(vector![0.0, -ground_height, 0.0]); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size, ground_height, ground_size); colliders.insert_with_parent(collider, handle, &mut bodies); @@ -44,7 +44,7 @@ pub fn init_world(testbed: &mut Testbed) { let z = -centerz + offset; // Build the rigid body. - let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![x, y, z]); + let rigid_body = RigidBodyBuilder::dynamic().translation(vector![x, y, z]); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cylinder(rad, rad); colliders.insert_with_parent(collider, handle, &mut bodies); diff --git a/examples3d/debug_dynamic_collider_add3.rs b/examples3d/debug_dynamic_collider_add3.rs index 9404a61..fa1054c 100644 --- a/examples3d/debug_dynamic_collider_add3.rs +++ b/examples3d/debug_dynamic_collider_add3.rs @@ -16,7 +16,7 @@ pub fn init_world(testbed: &mut Testbed) { let ground_size = 20.0; let ground_height = 0.1; - let rigid_body = RigidBodyBuilder::new_static().translation(vector![0.0, -ground_height, 0.0]); + let rigid_body = RigidBodyBuilder::fixed().translation(vector![0.0, -ground_height, 0.0]); let ground_handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size, ground_height, 0.4) .friction(0.15) @@ -28,7 +28,7 @@ pub fn init_world(testbed: &mut Testbed) { * Rolling ball */ let ball_rad = 0.1; - let rb = RigidBodyBuilder::new_dynamic() + let rb = RigidBodyBuilder::dynamic() .translation(vector![0.0, 0.2, 0.0]) .linvel(vector![10.0, 0.0, 0.0]); let ball_handle = bodies.insert(rb); diff --git a/examples3d/debug_friction3.rs b/examples3d/debug_friction3.rs index b48364d..9078bc4 100644 --- a/examples3d/debug_friction3.rs +++ b/examples3d/debug_friction3.rs @@ -16,13 +16,13 @@ pub fn init_world(testbed: &mut Testbed) { let ground_size = 100.0; let ground_height = 0.1; - let rigid_body = RigidBodyBuilder::new_static(); + let rigid_body = RigidBodyBuilder::fixed(); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size, ground_height, ground_size).friction(1.5); colliders.insert_with_parent(collider, handle, &mut bodies); // Build a dynamic box rigid body. - let rigid_body = RigidBodyBuilder::new_dynamic() + let rigid_body = RigidBodyBuilder::dynamic() .translation(vector![0.0, 1.1, 0.0]) .rotation(Vector::y() * 0.3); let handle = bodies.insert(rigid_body); diff --git a/examples3d/debug_infinite_fall3.rs b/examples3d/debug_infinite_fall3.rs index 7d03734..a62c92f 100644 --- a/examples3d/debug_infinite_fall3.rs +++ b/examples3d/debug_infinite_fall3.rs @@ -16,21 +16,21 @@ pub fn init_world(testbed: &mut Testbed) { let ground_size = 100.1; let ground_height = 2.1; - let rigid_body = RigidBodyBuilder::new_static().translation(vector![0.0, 4.0, 0.0]); + let rigid_body = RigidBodyBuilder::fixed().translation(vector![0.0, 4.0, 0.0]); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size, ground_height, ground_size); colliders.insert_with_parent(collider, handle, &mut bodies); let rad = 1.0; // Build the dynamic box rigid body. - let rigid_body = RigidBodyBuilder::new_dynamic() + let rigid_body = RigidBodyBuilder::dynamic() .translation(vector![0.0, 7.0 * rad, 0.0]) .can_sleep(false); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::ball(rad); colliders.insert_with_parent(collider, handle, &mut bodies); - let rigid_body = RigidBodyBuilder::new_dynamic() + let rigid_body = RigidBodyBuilder::dynamic() .translation(vector![0.0, 2.0 * rad, 0.0]) .can_sleep(false); let handle = bodies.insert(rigid_body); diff --git a/examples3d/debug_prismatic3.rs b/examples3d/debug_prismatic3.rs index 9f93237..815f4e5 100644 --- a/examples3d/debug_prismatic3.rs +++ b/examples3d/debug_prismatic3.rs @@ -7,7 +7,7 @@ fn prismatic_repro( impulse_joints: &mut ImpulseJointSet, box_center: Point, ) { - let box_rb = bodies.insert(RigidBodyBuilder::new_dynamic().translation(vector![ + let box_rb = bodies.insert(RigidBodyBuilder::dynamic().translation(vector![ box_center.x, box_center.y, box_center.z @@ -24,7 +24,7 @@ fn prismatic_repro( for pos in wheel_positions { let wheel_pos_in_world = box_center + pos; - let wheel_rb = bodies.insert(RigidBodyBuilder::new_dynamic().translation(vector![ + let wheel_rb = bodies.insert(RigidBodyBuilder::dynamic().translation(vector![ wheel_pos_in_world.x, wheel_pos_in_world.y, wheel_pos_in_world.z @@ -40,7 +40,7 @@ fn prismatic_repro( } // put a small box under one of the wheels - let gravel = bodies.insert(RigidBodyBuilder::new_dynamic().translation(vector![ + let gravel = bodies.insert(RigidBodyBuilder::dynamic().translation(vector![ box_center.x + 1.0, box_center.y - 2.4, -1.0 @@ -63,7 +63,7 @@ pub fn init_world(testbed: &mut Testbed) { let ground_size = 50.0; let ground_height = 0.1; - let rigid_body = RigidBodyBuilder::new_static().translation(vector![0.0, -ground_height, 0.0]); + let rigid_body = RigidBodyBuilder::fixed().translation(vector![0.0, -ground_height, 0.0]); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size, ground_height, ground_size); colliders.insert_with_parent(collider, handle, &mut bodies); diff --git a/examples3d/debug_rollback3.rs b/examples3d/debug_rollback3.rs index b40384c..9936e37 100644 --- a/examples3d/debug_rollback3.rs +++ b/examples3d/debug_rollback3.rs @@ -16,7 +16,7 @@ pub fn init_world(testbed: &mut Testbed) { let ground_size = 20.0; let ground_height = 0.1; - let rigid_body = RigidBodyBuilder::new_static().translation(vector![0.0, -ground_height, 0.0]); + let rigid_body = RigidBodyBuilder::fixed().translation(vector![0.0, -ground_height, 0.0]); let ground_handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size, ground_height, 0.4) .friction(0.15) @@ -28,7 +28,7 @@ pub fn init_world(testbed: &mut Testbed) { * Rolling ball */ let ball_rad = 0.1; - let rb = RigidBodyBuilder::new_dynamic() + let rb = RigidBodyBuilder::dynamic() .translation(vector![0.0, 0.2, 0.0]) .linvel(vector![10.0, 0.0, 0.0]); let ball_handle = bodies.insert(rb); diff --git a/examples3d/debug_shape_modification3.rs b/examples3d/debug_shape_modification3.rs index 5557131..0fc3cc5 100644 --- a/examples3d/debug_shape_modification3.rs +++ b/examples3d/debug_shape_modification3.rs @@ -16,7 +16,7 @@ pub fn init_world(testbed: &mut Testbed) { let ground_size = 20.0; let ground_height = 0.1; - let rigid_body = RigidBodyBuilder::new_static().translation(vector![0.0, -ground_height, 0.0]); + let rigid_body = RigidBodyBuilder::fixed().translation(vector![0.0, -ground_height, 0.0]); let ground_handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size, ground_height, ground_size) .friction(0.15) @@ -28,7 +28,7 @@ pub fn init_world(testbed: &mut Testbed) { * Rolling ball */ let ball_rad = 0.1; - let rb = RigidBodyBuilder::new_dynamic() + let rb = RigidBodyBuilder::dynamic() .translation(vector![0.0, 0.2, 0.0]) .linvel(vector![10.0, 0.0, 0.0]); let ball_handle = bodies.insert(rb); @@ -87,7 +87,7 @@ pub fn init_world(testbed: &mut Testbed) { let z = k as f32 * shiftz - centerz + offset; // Build the rigid body. - let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![x, y, z]); + let rigid_body = RigidBodyBuilder::dynamic().translation(vector![x, y, z]); let handle = bodies.insert(rigid_body); let collider = match j % 5 { diff --git a/examples3d/debug_triangle3.rs b/examples3d/debug_triangle3.rs index e84331a..b5ff530 100644 --- a/examples3d/debug_triangle3.rs +++ b/examples3d/debug_triangle3.rs @@ -17,13 +17,13 @@ pub fn init_world(testbed: &mut Testbed) { point![0.0, 0.0, 10.0], ]; - let rigid_body = RigidBodyBuilder::new_static().translation(vector![0.0, 0.0, 0.0]); + let rigid_body = RigidBodyBuilder::fixed().translation(vector![0.0, 0.0, 0.0]); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::triangle(vtx[0], vtx[1], vtx[2]); colliders.insert_with_parent(collider, handle, &mut bodies); // Dynamic box rigid body. - let rigid_body = RigidBodyBuilder::new_dynamic() + let rigid_body = RigidBodyBuilder::dynamic() .translation(vector![1.1, 0.01, 0.0]) // .rotation(Vector3::new(0.8, 0.2, 0.1)) .can_sleep(false); diff --git a/examples3d/debug_trimesh3.rs b/examples3d/debug_trimesh3.rs index f7fa651..c588545 100644 --- a/examples3d/debug_trimesh3.rs +++ b/examples3d/debug_trimesh3.rs @@ -38,7 +38,7 @@ pub fn init_world(testbed: &mut Testbed) { ]; // Dynamic box rigid body. - let rigid_body = RigidBodyBuilder::new_dynamic() + let rigid_body = RigidBodyBuilder::dynamic() .translation(vector![0.0, 35.0, 0.0]) // .rotation(Vector3::new(0.8, 0.2, 0.1)) .can_sleep(false); @@ -46,7 +46,7 @@ pub fn init_world(testbed: &mut Testbed) { let collider = ColliderBuilder::cuboid(1.0, 2.0, 1.0); colliders.insert_with_parent(collider, handle, &mut bodies); - let rigid_body = RigidBodyBuilder::new_static().translation(vector![0.0, 0.0, 0.0]); + let rigid_body = RigidBodyBuilder::fixed().translation(vector![0.0, 0.0, 0.0]); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::trimesh(vtx, idx); colliders.insert_with_parent(collider, handle, &mut bodies); diff --git a/examples3d/domino3.rs b/examples3d/domino3.rs index f57e2c5..2276c1c 100644 --- a/examples3d/domino3.rs +++ b/examples3d/domino3.rs @@ -16,7 +16,7 @@ pub fn init_world(testbed: &mut Testbed) { let ground_size = 200.1; let ground_height = 0.1; - let rigid_body = RigidBodyBuilder::new_static().translation(vector![0.0, -ground_height, 0.0]); + let rigid_body = RigidBodyBuilder::fixed().translation(vector![0.0, -ground_height, 0.0]); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size, ground_height, ground_size); colliders.insert_with_parent(collider, handle, &mut bodies); @@ -53,7 +53,7 @@ pub fn init_world(testbed: &mut Testbed) { Translation::new(x * curr_rad, width * 2.0 + ground_height, z * curr_rad) * tilt * rot; - let rigid_body = RigidBodyBuilder::new_dynamic().position(position); + let rigid_body = RigidBodyBuilder::dynamic().position(position); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(thickness, width * 2.0, width); colliders.insert_with_parent(collider, handle, &mut bodies); diff --git a/examples3d/fountain3.rs b/examples3d/fountain3.rs index bb7199f..3927cac 100644 --- a/examples3d/fountain3.rs +++ b/examples3d/fountain3.rs @@ -17,14 +17,14 @@ pub fn init_world(testbed: &mut Testbed) { let ground_size = 100.1; let ground_height = 2.1; // 16.0; - let rigid_body = RigidBodyBuilder::new_static().translation(vector![0.0, -ground_height, 0.0]); + let rigid_body = RigidBodyBuilder::fixed().translation(vector![0.0, -ground_height, 0.0]); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size, ground_height, ground_size); colliders.insert_with_parent(collider, handle, &mut bodies); // Callback that will be executed on the main loop to handle proximities. testbed.add_callback(move |mut graphics, physics, _, run_state| { - let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![0.0, 10.0, 0.0]); + let rigid_body = RigidBodyBuilder::dynamic().translation(vector![0.0, 10.0, 0.0]); let handle = physics.bodies.insert(rigid_body); let collider = match run_state.timestep_id % 3 { 0 => ColliderBuilder::round_cylinder(rad, rad, rad / 10.0), diff --git a/examples3d/harness_capsules3.rs b/examples3d/harness_capsules3.rs index 30849d3..d422c11 100644 --- a/examples3d/harness_capsules3.rs +++ b/examples3d/harness_capsules3.rs @@ -16,7 +16,7 @@ pub fn init_world(harness: &mut Harness) { let ground_size = 200.1; let ground_height = 0.1; - let rigid_body = RigidBodyBuilder::new_static().translation(vector![0.0, -ground_height, 0.0]); + let rigid_body = RigidBodyBuilder::fixed().translation(vector![0.0, -ground_height, 0.0]); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size, ground_height, ground_size); colliders.insert_with_parent(collider, handle, &mut bodies); @@ -43,7 +43,7 @@ pub fn init_world(harness: &mut Harness) { let z = k as f32 * shift - centerz + offset; // Build the rigid body. - let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![x, y, z]); + let rigid_body = RigidBodyBuilder::dynamic().translation(vector![x, y, z]); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::capsule_y(rad, rad); colliders.insert_with_parent(collider, handle, &mut bodies); diff --git a/examples3d/heightfield3.rs b/examples3d/heightfield3.rs index e144442..360ba3a 100644 --- a/examples3d/heightfield3.rs +++ b/examples3d/heightfield3.rs @@ -31,7 +31,7 @@ pub fn init_world(testbed: &mut Testbed) { } }); - let rigid_body = RigidBodyBuilder::new_static(); + let rigid_body = RigidBodyBuilder::fixed(); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::heightfield(heights, ground_size); colliders.insert_with_parent(collider, handle, &mut bodies); @@ -55,7 +55,7 @@ pub fn init_world(testbed: &mut Testbed) { let z = k as f32 * shift - centerz; // Build the rigid body. - let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![x, y, z]); + let rigid_body = RigidBodyBuilder::dynamic().translation(vector![x, y, z]); let handle = bodies.insert(rigid_body); let collider = match j % 6 { diff --git a/examples3d/joints3.rs b/examples3d/joints3.rs index 73783d8..b5dc984 100644 --- a/examples3d/joints3.rs +++ b/examples3d/joints3.rs @@ -9,9 +9,9 @@ fn create_coupled_joints( origin: Point, use_articulations: bool, ) { - let ground = bodies.insert(RigidBodyBuilder::new_static().translation(origin.coords)); + let ground = bodies.insert(RigidBodyBuilder::fixed().translation(origin.coords)); let body1 = bodies.insert( - RigidBodyBuilder::new_dynamic() + RigidBodyBuilder::dynamic() .translation(origin.coords) .linvel(vector![5.0, 5.0, 5.0]), ); @@ -42,15 +42,14 @@ fn create_prismatic_joints( let rad = 0.4; let shift = 2.0; - let ground = RigidBodyBuilder::new_static().translation(vector![origin.x, origin.y, origin.z]); + let ground = RigidBodyBuilder::fixed().translation(vector![origin.x, origin.y, origin.z]); let mut curr_parent = bodies.insert(ground); let collider = ColliderBuilder::cuboid(rad, rad, rad); colliders.insert_with_parent(collider, curr_parent, bodies); for i in 0..num { let z = origin.z + (i + 1) as f32 * shift; - let rigid_body = - RigidBodyBuilder::new_dynamic().translation(vector![origin.x, origin.y, z]); + let rigid_body = RigidBodyBuilder::dynamic().translation(vector![origin.x, origin.y, z]); let curr_child = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(rad, rad, rad); colliders.insert_with_parent(collider, curr_child, bodies); @@ -87,15 +86,14 @@ fn create_actuated_prismatic_joints( let rad = 0.4; let shift = 2.0; - let ground = RigidBodyBuilder::new_static().translation(vector![origin.x, origin.y, origin.z]); + let ground = RigidBodyBuilder::fixed().translation(vector![origin.x, origin.y, origin.z]); let mut curr_parent = bodies.insert(ground); let collider = ColliderBuilder::cuboid(rad, rad, rad); colliders.insert_with_parent(collider, curr_parent, bodies); for i in 0..num { let z = origin.z + (i + 1) as f32 * shift; - let rigid_body = - RigidBodyBuilder::new_dynamic().translation(vector![origin.x, origin.y, z]); + let rigid_body = RigidBodyBuilder::dynamic().translation(vector![origin.x, origin.y, z]); let curr_child = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(rad, rad, rad); colliders.insert_with_parent(collider, curr_child, bodies); @@ -153,7 +151,7 @@ fn create_revolute_joints( let rad = 0.4; let shift = 2.0; - let ground = RigidBodyBuilder::new_static().translation(vector![origin.x, origin.y, 0.0]); + let ground = RigidBodyBuilder::fixed().translation(vector![origin.x, origin.y, 0.0]); let mut curr_parent = bodies.insert(ground); let collider = ColliderBuilder::cuboid(rad, rad, rad); colliders.insert_with_parent(collider, curr_parent, bodies); @@ -170,7 +168,7 @@ fn create_revolute_joints( let mut handles = [curr_parent; 4]; for k in 0..4 { - let rigid_body = RigidBodyBuilder::new_dynamic().position(positions[k]); + let rigid_body = RigidBodyBuilder::dynamic().position(positions[k]); handles[k] = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(rad, rad, rad); colliders.insert_with_parent(collider, handles[k], bodies); @@ -210,14 +208,13 @@ fn create_revolute_joints_with_limits( origin: Point, use_articulations: bool, ) { - let ground = bodies.insert(RigidBodyBuilder::new_static().translation(origin.coords)); + let ground = bodies.insert(RigidBodyBuilder::fixed().translation(origin.coords)); - let platform1 = bodies.insert(RigidBodyBuilder::new_dynamic().translation(origin.coords)); + let platform1 = bodies.insert(RigidBodyBuilder::dynamic().translation(origin.coords)); colliders.insert_with_parent(ColliderBuilder::cuboid(4.0, 0.2, 2.0), platform1, bodies); let shift = vector![0.0, 0.0, 6.0]; - let platform2 = - bodies.insert(RigidBodyBuilder::new_dynamic().translation(origin.coords + shift)); + let platform2 = bodies.insert(RigidBodyBuilder::dynamic().translation(origin.coords + shift)); colliders.insert_with_parent(ColliderBuilder::cuboid(4.0, 0.2, 2.0), platform2, bodies); let z = Vector::z_axis(); @@ -256,9 +253,8 @@ fn create_revolute_joints_with_limits( } // Let’s add a couple of cuboids that will fall on the platforms, triggering the joint limits. - let cuboid_body1 = bodies.insert( - RigidBodyBuilder::new_dynamic().translation(origin.coords + vector![-2.0, 4.0, 0.0]), - ); + let cuboid_body1 = bodies + .insert(RigidBodyBuilder::dynamic().translation(origin.coords + vector![-2.0, 4.0, 0.0])); colliders.insert_with_parent( ColliderBuilder::cuboid(0.6, 0.6, 0.6).friction(1.0), cuboid_body1, @@ -266,8 +262,7 @@ fn create_revolute_joints_with_limits( ); let cuboid_body2 = bodies.insert( - RigidBodyBuilder::new_dynamic() - .translation(origin.coords + shift + vector![2.0, 16.0, 0.0]), + RigidBodyBuilder::dynamic().translation(origin.coords + shift + vector![2.0, 16.0, 0.0]), ); colliders.insert_with_parent( ColliderBuilder::cuboid(0.6, 0.6, 0.6).friction(1.0), @@ -299,7 +294,7 @@ fn create_fixed_joints( // fixed bodies. Because physx will crash if we add // a joint between these. let status = if i == 0 && (k % 4 == 0 && k != num - 2 || k == num - 1) { - RigidBodyType::Static + RigidBodyType::Fixed } else { RigidBodyType::Dynamic }; @@ -358,7 +353,7 @@ fn create_spherical_joints( let fi = i as f32; let status = if i == 0 && (k % 4 == 0 || k == num - 1) { - RigidBodyType::Static + RigidBodyType::Fixed } else { RigidBodyType::Dynamic }; @@ -408,17 +403,16 @@ fn create_spherical_joints_with_limits( ) { let shift = vector![0.0, 0.0, 3.0]; - let ground = bodies.insert(RigidBodyBuilder::new_static().translation(origin.coords)); + let ground = bodies.insert(RigidBodyBuilder::fixed().translation(origin.coords)); let ball1 = bodies.insert( - RigidBodyBuilder::new_dynamic() + RigidBodyBuilder::dynamic() .translation(origin.coords + shift) .linvel(vector![20.0, 20.0, 0.0]), ); colliders.insert_with_parent(ColliderBuilder::cuboid(1.0, 1.0, 1.0), ball1, bodies); - let ball2 = - bodies.insert(RigidBodyBuilder::new_dynamic().translation(origin.coords + shift * 2.0)); + let ball2 = bodies.insert(RigidBodyBuilder::dynamic().translation(origin.coords + shift * 2.0)); colliders.insert_with_parent(ColliderBuilder::cuboid(1.0, 1.0, 1.0), ball2, bodies); let joint1 = SphericalJointBuilder::new() @@ -465,7 +459,7 @@ fn create_actuated_revolute_joints( // fixed bodies. Because physx will crash if we add // a joint between these. let status = if i == 0 { - RigidBodyType::Static + RigidBodyType::Fixed } else { RigidBodyType::Dynamic }; @@ -533,7 +527,7 @@ fn create_actuated_spherical_joints( // fixed bodies. Because physx will crash if we add // a joint between these. let status = if i == 0 { - RigidBodyType::Static + RigidBodyType::Fixed } else { RigidBodyType::Dynamic }; diff --git a/examples3d/keva3.rs b/examples3d/keva3.rs index 30e5246..ecd6e77 100644 --- a/examples3d/keva3.rs +++ b/examples3d/keva3.rs @@ -38,7 +38,7 @@ pub fn build_block( }; // Build the rigid body. - let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![ + let rigid_body = RigidBodyBuilder::dynamic().translation(vector![ x + dim.x + shift.x, y + dim.y + shift.y, z + dim.z + shift.z @@ -59,7 +59,7 @@ pub fn build_block( for i in 0..(block_width / (dim.x as f32 * 2.0)) as usize { for j in 0..(block_width / (dim.z as f32 * 2.0)) as usize { // Build the rigid body. - let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![ + let rigid_body = RigidBodyBuilder::dynamic().translation(vector![ i as f32 * dim.x * 2.0 + dim.x + shift.x, dim.y + shift.y + block_height, j as f32 * dim.z * 2.0 + dim.z + shift.z @@ -88,7 +88,7 @@ pub fn init_world(testbed: &mut Testbed) { let ground_size = 50.0; let ground_height = 0.1; - let rigid_body = RigidBodyBuilder::new_static().translation(vector![0.0, -ground_height, 0.0]); + let rigid_body = RigidBodyBuilder::fixed().translation(vector![0.0, -ground_height, 0.0]); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size, ground_height, ground_size); colliders.insert_with_parent(collider, handle, &mut bodies); diff --git a/examples3d/locked_rotations3.rs b/examples3d/locked_rotations3.rs index e45aefd..c8d2a5d 100644 --- a/examples3d/locked_rotations3.rs +++ b/examples3d/locked_rotations3.rs @@ -19,7 +19,7 @@ pub fn init_world(testbed: &mut Testbed) { let ground_size = 5.0; let ground_height = 0.1; - let rigid_body = RigidBodyBuilder::new_static().translation(vector![0.0, -ground_height, 0.0]); + let rigid_body = RigidBodyBuilder::fixed().translation(vector![0.0, -ground_height, 0.0]); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size, ground_height, ground_size); colliders.insert_with_parent(collider, handle, &mut bodies); @@ -27,7 +27,7 @@ pub fn init_world(testbed: &mut Testbed) { /* * A rectangle that only rotates along the `x` axis. */ - let rigid_body = RigidBodyBuilder::new_dynamic() + let rigid_body = RigidBodyBuilder::dynamic() .translation(vector![0.0, 3.0, 0.0]) .lock_translations() .restrict_rotations(true, false, false); @@ -38,7 +38,7 @@ pub fn init_world(testbed: &mut Testbed) { /* * A tilted capsule that cannot rotate. */ - let rigid_body = RigidBodyBuilder::new_dynamic() + let rigid_body = RigidBodyBuilder::dynamic() .translation(vector![0.0, 5.0, 0.0]) .rotation(Vector::x() * 1.0) .lock_rotations(); diff --git a/examples3d/one_way_platforms3.rs b/examples3d/one_way_platforms3.rs index b82f564..6f214b5 100644 --- a/examples3d/one_way_platforms3.rs +++ b/examples3d/one_way_platforms3.rs @@ -68,7 +68,7 @@ pub fn init_world(testbed: &mut Testbed) { /* * Ground */ - let rigid_body = RigidBodyBuilder::new_static(); + let rigid_body = RigidBodyBuilder::fixed(); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(9.0, 0.5, 25.0) @@ -96,7 +96,7 @@ pub fn init_world(testbed: &mut Testbed) { if run_state.timestep_id % 50 == 0 && physics.bodies.len() <= 7 { // Spawn a new cube. let collider = ColliderBuilder::cuboid(1.0, 2.0, 1.5); - let body = RigidBodyBuilder::new_dynamic().translation(vector![0.0, 6.0, 20.0]); + let body = RigidBodyBuilder::dynamic().translation(vector![0.0, 6.0, 20.0]); let handle = physics.bodies.insert(body); physics .colliders diff --git a/examples3d/platform3.rs b/examples3d/platform3.rs index 5f757fa..d42cb76 100644 --- a/examples3d/platform3.rs +++ b/examples3d/platform3.rs @@ -16,7 +16,7 @@ pub fn init_world(testbed: &mut Testbed) { let ground_size = 10.0; let ground_height = 0.1; - let rigid_body = RigidBodyBuilder::new_static().translation(vector![0.0, -ground_height, 0.0]); + let rigid_body = RigidBodyBuilder::fixed().translation(vector![0.0, -ground_height, 0.0]); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size, ground_height, ground_size); colliders.insert_with_parent(collider, handle, &mut bodies); @@ -40,7 +40,7 @@ pub fn init_world(testbed: &mut Testbed) { let z = k as f32 * shift - centerz; // Build the rigid body. - let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![x, y, z]); + let rigid_body = RigidBodyBuilder::dynamic().translation(vector![x, y, z]); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(rad, rad, rad); colliders.insert_with_parent(collider, handle, &mut bodies); @@ -51,7 +51,7 @@ pub fn init_world(testbed: &mut Testbed) { /* * Setup a velocity-based kinematic rigid body. */ - let platform_body = RigidBodyBuilder::new_kinematic_velocity_based().translation(vector![ + let platform_body = RigidBodyBuilder::kinematic_velocity_based().translation(vector![ 0.0, 1.5 + 0.8, -10.0 * rad @@ -63,7 +63,7 @@ pub fn init_world(testbed: &mut Testbed) { /* * Setup a position-based kinematic rigid body. */ - let platform_body = RigidBodyBuilder::new_kinematic_position_based().translation(vector![ + let platform_body = RigidBodyBuilder::kinematic_position_based().translation(vector![ 0.0, 2.0 + 1.5 + 0.8, -10.0 * rad diff --git a/examples3d/primitives3.rs b/examples3d/primitives3.rs index a664308..ab2f555 100644 --- a/examples3d/primitives3.rs +++ b/examples3d/primitives3.rs @@ -16,7 +16,7 @@ pub fn init_world(testbed: &mut Testbed) { let ground_size = 100.1; let ground_height = 2.1; - let rigid_body = RigidBodyBuilder::new_static().translation(vector![0.0, -ground_height, 0.0]); + let rigid_body = RigidBodyBuilder::fixed().translation(vector![0.0, -ground_height, 0.0]); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size, ground_height, ground_size); colliders.insert_with_parent(collider, handle, &mut bodies); @@ -44,7 +44,7 @@ pub fn init_world(testbed: &mut Testbed) { let z = k as f32 * shiftz - centerz + offset; // Build the rigid body. - let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![x, y, z]); + let rigid_body = RigidBodyBuilder::dynamic().translation(vector![x, y, z]); let handle = bodies.insert(rigid_body); let collider = match j % 5 { diff --git a/examples3d/restitution3.rs b/examples3d/restitution3.rs index 834fe22..6acdac5 100644 --- a/examples3d/restitution3.rs +++ b/examples3d/restitution3.rs @@ -16,7 +16,7 @@ pub fn init_world(testbed: &mut Testbed) { let ground_size = 20.; let ground_height = 1.0; - let rigid_body = RigidBodyBuilder::new_static().translation(vector![0.0, -ground_height, 0.0]); + let rigid_body = RigidBodyBuilder::fixed().translation(vector![0.0, -ground_height, 0.0]); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size, ground_height, 2.0).restitution(1.0); colliders.insert_with_parent(collider, handle, &mut bodies); @@ -27,7 +27,7 @@ pub fn init_world(testbed: &mut Testbed) { for j in 0..2 { for i in 0..=num { let x = (i as f32) - num as f32 / 2.0; - let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![ + let rigid_body = RigidBodyBuilder::dynamic().translation(vector![ x * 2.0, 10.0 * (j as f32 + 1.0), 0.0 diff --git a/examples3d/sensor3.rs b/examples3d/sensor3.rs index e09359d..3c92460 100644 --- a/examples3d/sensor3.rs +++ b/examples3d/sensor3.rs @@ -16,7 +16,7 @@ pub fn init_world(testbed: &mut Testbed) { let ground_size = 200.1; let ground_height = 0.1; - let rigid_body = RigidBodyBuilder::new_static().translation(vector![0.0, -ground_height, 0.0]); + let rigid_body = RigidBodyBuilder::fixed().translation(vector![0.0, -ground_height, 0.0]); let ground_handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(ground_size, ground_height, ground_size); colliders.insert_with_parent(collider, ground_handle, &mut bodies); @@ -38,7 +38,7 @@ pub fn init_world(testbed: &mut Testbed) { let z = k as f32 * shift - centerz; // Build the rigid body. - let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![x, y, z]); + let rigid_body = RigidBodyBuilder::dynamic().translation(vector![x, y, z]); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::cuboid(rad, rad, rad); colliders.insert_with_parent(collider, handle, &mut bodies); @@ -52,7 +52,7 @@ pub fn init_world(testbed: &mut Testbed) { */ // Rigid body so that the sensor can move. - let sensor = RigidBodyBuilder::new_dynamic().translation(vector![0.0, 5.0, 0.0]); + let sensor = RigidBodyBuilder::dynamic().translation(vector![0.0, 5.0, 0.0]); let sensor_handle = bodies.insert(sensor); // Solid cube attached to the sensor which diff --git a/examples3d/trimesh3.rs b/examples3d/trimesh3.rs index 1985671..729fc3e 100644 --- a/examples3d/trimesh3.rs +++ b/examples3d/trimesh3.rs @@ -36,7 +36,7 @@ pub fn init_world(testbed: &mut Testbed) { let heightfield = HeightField::new(heights, ground_size); let (vertices, indices) = heightfield.to_trimesh(); - let rigid_body = RigidBodyBuilder::new_static(); + let rigid_body = RigidBodyBuilder::fixed(); let handle = bodies.insert(rigid_body); let collider = ColliderBuilder::trimesh(vertices, indices); colliders.insert_with_parent(collider, handle, &mut bodies); @@ -60,7 +60,7 @@ pub fn init_world(testbed: &mut Testbed) { let z = k as f32 * shift - centerz; // Build the rigid body. - let rigid_body = RigidBodyBuilder::new_dynamic().translation(vector![x, y, z]); + let rigid_body = RigidBodyBuilder::dynamic().translation(vector![x, y, z]); let handle = bodies.insert(rigid_body); let collider = match j % 6 { diff --git a/src/dynamics/ccd/ccd_solver.rs b/src/dynamics/ccd/ccd_solver.rs index b3a1608..d15b28c 100644 --- a/src/dynamics/ccd/ccd_solver.rs +++ b/src/dynamics/ccd/ccd_solver.rs @@ -412,7 +412,7 @@ impl CCDSolver { return PredictedImpacts::ImpactsAfterEndTime(min_overstep); } - // NOTE: all static bodies (and kinematic bodies?) should be considered as "frozen", this + // NOTE: all fixed bodies (and kinematic bodies?) should be considered as "frozen", this // may avoid some resweeps. let mut pseudo_intersections_to_check = vec![]; diff --git a/src/dynamics/island_manager.rs b/src/dynamics/island_manager.rs index 7cf16d6..06f3820 100644 --- a/src/dynamics/island_manager.rs +++ b/src/dynamics/island_manager.rs @@ -259,7 +259,7 @@ impl IslandManager { if rb_ids.active_set_timestamp == self.active_set_timestamp || !rb_status.is_dynamic() { // We already visited this body and its neighbors. - // Also, we don't propagate awake state through static bodies. + // Also, we don't propagate awake state through fixed bodies. continue; } diff --git a/src/dynamics/rigid_body.rs b/src/dynamics/rigid_body.rs index 1bfdf48..695b256 100644 --- a/src/dynamics/rigid_body.rs +++ b/src/dynamics/rigid_body.rs @@ -112,7 +112,7 @@ impl RigidBody { self.changes.insert(RigidBodyChanges::TYPE); self.rb_type = status; - if status == RigidBodyType::Static { + if status == RigidBodyType::Fixed { self.rb_vels = RigidBodyVelocity::zero(); } } @@ -372,11 +372,11 @@ impl RigidBody { self.rb_type.is_kinematic() } - /// Is this rigid body static? + /// Is this rigid body fixed? /// - /// A static body cannot move and is not affected by forces. - pub fn is_static(&self) -> bool { - self.rb_type == RigidBodyType::Static + /// A fixed body cannot move and is not affected by forces. + pub fn is_fixed(&self) -> bool { + self.rb_type == RigidBodyType::Fixed } /// The mass of this rigid body. @@ -487,7 +487,7 @@ impl RigidBody { /// Is this rigid body sleeping? pub fn is_sleeping(&self) -> bool { // TODO: should we: - // - return false for static bodies. + // - return false for fixed bodies. // - return true for non-sleeping dynamic bodies. // - return true only for kinematic bodies with non-zero velocity? self.rb_activation.sleeping @@ -531,7 +531,7 @@ impl RigidBody { RigidBodyType::KinematicVelocityBased => { self.rb_vels.linvel = linvel; } - RigidBodyType::Static | RigidBodyType::KinematicPositionBased => {} + RigidBodyType::Fixed | RigidBodyType::KinematicPositionBased => {} } } } @@ -553,7 +553,7 @@ impl RigidBody { RigidBodyType::KinematicVelocityBased => { self.rb_vels.angvel = angvel; } - RigidBodyType::Static | RigidBodyType::KinematicPositionBased => {} + RigidBodyType::Fixed | RigidBodyType::KinematicPositionBased => {} } } } @@ -575,7 +575,7 @@ impl RigidBody { RigidBodyType::KinematicVelocityBased => { self.rb_vels.angvel = angvel; } - RigidBodyType::Static | RigidBodyType::KinematicPositionBased => {} + RigidBodyType::Fixed | RigidBodyType::KinematicPositionBased => {} } } } @@ -905,7 +905,7 @@ pub struct RigidBodyBuilder { } impl RigidBodyBuilder { - /// Initialize a new builder for a rigid body which is either static, dynamic, or kinematic. + /// Initialize a new builder for a rigid body which is either fixed, dynamic, or kinematic. pub fn new(rb_type: RigidBodyType) -> Self { Self { position: Isometry::identity(), @@ -925,23 +925,39 @@ impl RigidBodyBuilder { } } - /// Initializes the builder of a new static rigid body. + /// Initializes the builder of a new fixed rigid body. + #[deprecated(note = "use `RigidBodyBuilder::fixed()` instead")] pub fn new_static() -> Self { - Self::new(RigidBodyType::Static) + Self::fixed() + } + /// Initializes the builder of a new velocity-based kinematic rigid body. + #[deprecated(note = "use `RigidBodyBuilder::kinematic_velocity_based()` instead")] + pub fn new_kinematic_velocity_based() -> Self { + Self::kinematic_velocity_based() + } + /// Initializes the builder of a new position-based kinematic rigid body. + #[deprecated(note = "use `RigidBodyBuilder::kinematic_position_based()` instead")] + pub fn new_kinematic_position_based() -> Self { + Self::kinematic_position_based() } - /// Initializes the builder of a new kinematic rigid body. - pub fn new_kinematic_velocity_based() -> Self { + /// Initializes the builder of a new fixed rigid body. + pub fn fixed() -> Self { + Self::new(RigidBodyType::Fixed) + } + + /// Initializes the builder of a new velocity-based kinematic rigid body. + pub fn kinematic_velocity_based() -> Self { Self::new(RigidBodyType::KinematicVelocityBased) } - /// Initializes the builder of a new kinematic rigid body. - pub fn new_kinematic_position_based() -> Self { + /// Initializes the builder of a new position-based kinematic rigid body. + pub fn kinematic_position_based() -> Self { Self::new(RigidBodyType::KinematicPositionBased) } /// Initializes the builder of a new dynamic rigid body. - pub fn new_dynamic() -> Self { + pub fn dynamic() -> Self { Self::new(RigidBodyType::Dynamic) } diff --git a/src/dynamics/rigid_body_components.rs b/src/dynamics/rigid_body_components.rs index 52072ea..cac0600 100644 --- a/src/dynamics/rigid_body_components.rs +++ b/src/dynamics/rigid_body_components.rs @@ -57,8 +57,8 @@ pub type BodyStatus = RigidBodyType; pub enum RigidBodyType { /// A `RigidBodyType::Dynamic` body can be affected by all external forces. Dynamic = 0, - /// A `RigidBodyType::Static` body cannot be affected by external forces. - Static = 1, + /// A `RigidBodyType::Fixed` body cannot be affected by external forces. + Fixed = 1, /// A `RigidBodyType::KinematicPositionBased` body cannot be affected by any external forces but can be controlled /// by the user at the position level while keeping realistic one-way interaction with dynamic bodies. /// @@ -73,14 +73,14 @@ pub enum RigidBodyType { /// cannot be pushed by anything. In other words, the trajectory of a kinematic body can only be /// modified by the user and is independent from any contact or joint it is involved in. KinematicVelocityBased = 3, - // Semikinematic, // A kinematic that performs automatic CCD with the static environment to avoid traversing it? + // Semikinematic, // A kinematic that performs automatic CCD with the fixed environment to avoid traversing it? // Disabled, } impl RigidBodyType { - /// Is this rigid-body static (i.e. cannot move)? - pub fn is_static(self) -> bool { - self == RigidBodyType::Static + /// Is this rigid-body fixed (i.e. cannot move)? + pub fn is_fixed(self) -> bool { + self == RigidBodyType::Fixed } /// Is this rigid-body dynamic (i.e. can move and be affected by forces)? diff --git a/src/dynamics/solver/interaction_groups.rs b/src/dynamics/solver/interaction_groups.rs index 451f930..d806251 100644 --- a/src/dynamics/solver/interaction_groups.rs +++ b/src/dynamics/solver/interaction_groups.rs @@ -93,20 +93,20 @@ impl ParallelInteractionGroups { .zip(self.interaction_colors.iter_mut()) { let mut body_pair = interactions[*interaction_id].body_pair(); - let is_static1 = body_pair + let is_fixed1 = body_pair .0 - .map(|b| ComponentSet::::index(bodies, b.0).is_static()) + .map(|b| ComponentSet::::index(bodies, b.0).is_fixed()) .unwrap_or(true); - let is_static2 = body_pair + let is_fixed2 = body_pair .1 - .map(|b| ComponentSet::::index(bodies, b.0).is_static()) + .map(|b| ComponentSet::::index(bodies, b.0).is_fixed()) .unwrap_or(true); let representative = |handle: RigidBodyHandle| { if let Some(link) = multibodies.rigid_body_link(handle).copied() { let multibody = multibodies.get_multibody(link.multibody).unwrap(); multibody - .link(1) // Use the link 1 to cover the case where the multibody root is static. + .link(1) // Use the link 1 to cover the case where the multibody root is fixed. .or(multibody.link(0)) // TODO: Never happens? .map(|l| l.rigid_body) .unwrap() @@ -120,7 +120,7 @@ impl ParallelInteractionGroups { body_pair.1.map(representative), ); - match (is_static1, is_static2) { + match (is_fixed1, is_fixed2) { (false, false) => { let rb_ids1: &RigidBodyIds = bodies.index(body_pair.0.unwrap().0); let rb_ids2: &RigidBodyIds = bodies.index(body_pair.1.unwrap().0); @@ -268,10 +268,10 @@ impl InteractionGroups { let (status2, ids2): (&RigidBodyType, &RigidBodyIds) = bodies.index_bundle(interaction.body2.0); - let is_static1 = !status1.is_dynamic(); - let is_static2 = !status2.is_dynamic(); + let is_fixed1 = !status1.is_dynamic(); + let is_fixed2 = !status2.is_dynamic(); - if is_static1 && is_static2 { + if is_fixed1 && is_fixed2 { continue; } @@ -334,13 +334,13 @@ impl InteractionGroups { } } - // NOTE: static bodies don't transmit forces. Therefore they don't + // NOTE: fixed bodies don't transmit forces. Therefore they don't // imply any interaction conflicts. - if !is_static1 { + if !is_fixed1 { self.body_masks[i1] |= target_mask_bit; } - if !is_static2 { + if !is_fixed2 { self.body_masks[i2] |= target_mask_bit; } } @@ -431,21 +431,21 @@ impl InteractionGroups { let data: (_, &RigidBodyIds) = bodies.index_bundle(rb1.0); (*data.0, data.1.active_set_offset) } else { - (RigidBodyType::Static, 0) + (RigidBodyType::Fixed, 0) }; let (status2, active_set_offset2) = if let Some(rb2) = interaction.data.rigid_body2 { let data: (_, &RigidBodyIds) = bodies.index_bundle(rb2.0); (*data.0, data.1.active_set_offset) } else { - (RigidBodyType::Static, 0) + (RigidBodyType::Fixed, 0) }; - let is_static1 = !status1.is_dynamic(); - let is_static2 = !status2.is_dynamic(); + let is_fixed1 = !status1.is_dynamic(); + let is_fixed2 = !status2.is_dynamic(); - // TODO: don't generate interactions between static bodies in the first place. - if is_static1 && is_static2 { + // TODO: don't generate interactions between fixed bodies in the first place. + if is_fixed1 && is_fixed2 { continue; } @@ -489,13 +489,13 @@ impl InteractionGroups { occupied_mask = occupied_mask | target_mask_bit; } - // NOTE: static bodies don't transmit forces. Therefore they don't + // NOTE: fixed bodies don't transmit forces. Therefore they don't // imply any interaction conflicts. - if !is_static1 { + if !is_fixed1 { self.body_masks[i1] |= target_mask_bit; } - if !is_static2 { + if !is_fixed2 { self.body_masks[i2] |= target_mask_bit; } } diff --git a/src/geometry/broad_phase_multi_sap/broad_phase.rs b/src/geometry/broad_phase_multi_sap/broad_phase.rs index d2b0076..0149adf 100644 --- a/src/geometry/broad_phase_multi_sap/broad_phase.rs +++ b/src/geometry/broad_phase_multi_sap/broad_phase.rs @@ -634,7 +634,7 @@ mod test { let mut multibody_joints = MultibodyJointSet::new(); let mut islands = IslandManager::new(); - let rb = RigidBodyBuilder::new_dynamic().build(); + let rb = RigidBodyBuilder::dynamic().build(); let co = ColliderBuilder::ball(0.5).build(); let hrb = bodies.insert(rb); let coh = colliders.insert_with_parent(co, hrb, &mut bodies); @@ -652,7 +652,7 @@ mod test { broad_phase.update(0.0, &mut colliders, &[], &[coh], &mut events); // Create another body. - let rb = RigidBodyBuilder::new_dynamic().build(); + let rb = RigidBodyBuilder::dynamic().build(); let co = ColliderBuilder::ball(0.5).build(); let hrb = bodies.insert(rb); let coh = colliders.insert_with_parent(co, hrb, &mut bodies); diff --git a/src/geometry/collider_components.rs b/src/geometry/collider_components.rs index fe2961f..5f27823 100644 --- a/src/geometry/collider_components.rs +++ b/src/geometry/collider_components.rs @@ -285,18 +285,18 @@ bitflags::bitflags! { /// and another collider attached to a kinematic body. const DYNAMIC_KINEMATIC = 0b0000_0000_0000_1100; /// Enable collision-detection between a collider attached to a dynamic body - /// and another collider attached to a static body (or not attached to any body). + /// and another collider attached to a fixed body (or not attached to any body). const DYNAMIC_STATIC = 0b0000_0000_0000_0010; /// Enable collision-detection between a collider attached to a kinematic body /// and another collider attached to a kinematic body. const KINEMATIC_KINEMATIC = 0b1100_1100_0000_0000; /// Enable collision-detection between a collider attached to a kinematic body - /// and another collider attached to a static body (or not attached to any body). + /// and another collider attached to a fixed body (or not attached to any body). const KINEMATIC_STATIC = 0b0010_0010_0000_0000; - /// Enable collision-detection between a collider attached to a static body (or - /// not attached to any body) and another collider attached to a static body (or + /// Enable collision-detection between a collider attached to a fixed body (or + /// not attached to any body) and another collider attached to a fixed body (or /// not attached to any body). const STATIC_STATIC = 0b0000_0000_0010_0000; } diff --git a/src/geometry/narrow_phase.rs b/src/geometry/narrow_phase.rs index 400c635..cf78b81 100644 --- a/src/geometry/narrow_phase.rs +++ b/src/geometry/narrow_phase.rs @@ -392,7 +392,7 @@ impl NarrowPhase { // For each modified colliders, we need to wake-up the bodies it is in contact with // so that the narrow-phase properly takes into account the change in, e.g., // collision groups. Waking up the modified collider's parent isn't enough because - // it could be a static or kinematic body which don't propagate the wake-up state. + // it could be a fixed or kinematic body which don't propagate the wake-up state. let co_parent: Option<&ColliderParent> = colliders.get(handle.0); let (co_changes, co_type): (&ColliderChanges, &ColliderType) = @@ -740,8 +740,8 @@ impl NarrowPhase { } // TODO: avoid lookup into bodies. - let mut rb_type1 = RigidBodyType::Static; - let mut rb_type2 = RigidBodyType::Static; + let mut rb_type1 = RigidBodyType::Fixed; + let mut rb_type2 = RigidBodyType::Fixed; if let Some(co_parent1) = co_parent1 { rb_type1 = *bodies.index(co_parent1.handle.0); @@ -865,8 +865,8 @@ impl NarrowPhase { } // TODO: avoid lookup into bodies. - let mut rb_type1 = RigidBodyType::Static; - let mut rb_type2 = RigidBodyType::Static; + let mut rb_type1 = RigidBodyType::Fixed; + let mut rb_type2 = RigidBodyType::Fixed; if let Some(co_parent1) = co_parent1 { rb_type1 = *bodies.index(co_parent1.handle.0); @@ -1076,7 +1076,7 @@ impl NarrowPhase { bodies.index_bundle(handle1.0); (data.0.active_island_id, *data.1, data.2.sleeping) } else { - (0, RigidBodyType::Static, true) + (0, RigidBodyType::Fixed, true) }; let (active_island_id2, rb_type2, sleeping2) = @@ -1085,7 +1085,7 @@ impl NarrowPhase { bodies.index_bundle(handle2.0); (data.0.active_island_id, *data.1, data.2.sleeping) } else { - (0, RigidBodyType::Static, true) + (0, RigidBodyType::Fixed, true) }; if (rb_type1.is_dynamic() || rb_type2.is_dynamic()) diff --git a/src/pipeline/physics_pipeline.rs b/src/pipeline/physics_pipeline.rs index ba172c4..3f74b48 100644 --- a/src/pipeline/physics_pipeline.rs +++ b/src/pipeline/physics_pipeline.rs @@ -688,7 +688,7 @@ mod test { use crate::prelude::MultibodyJointSet; #[test] - fn kinematic_and_static_contact_crash() { + fn kinematic_and_fixed_contact_crash() { let mut colliders = ColliderSet::new(); let mut impulse_joints = ImpulseJointSet::new(); let mut multibody_joints = MultibodyJointSet::new(); @@ -698,13 +698,13 @@ mod test { let mut bodies = RigidBodySet::new(); let mut islands = IslandManager::new(); - let rb = RigidBodyBuilder::new_static().build(); + let rb = RigidBodyBuilder::fixed().build(); let h1 = bodies.insert(rb.clone()); let co = ColliderBuilder::ball(10.0).build(); colliders.insert_with_parent(co.clone(), h1, &mut bodies); // The same but with a kinematic body. - let rb = RigidBodyBuilder::new_kinematic_position_based().build(); + let rb = RigidBodyBuilder::kinematic_position_based().build(); let h2 = bodies.insert(rb.clone()); colliders.insert_with_parent(co, h2, &mut bodies); @@ -737,18 +737,18 @@ mod test { let mut bodies = RigidBodySet::new(); // Check that removing the body right after inserting it works. - // We add two dynamic bodies, one kinematic body and one static body before removing + // We add two dynamic bodies, one kinematic body and one fixed body before removing // them. This include a non-regression test where deleting a kimenatic body crashes. - let rb = RigidBodyBuilder::new_dynamic().build(); + let rb = RigidBodyBuilder::dynamic().build(); let h1 = bodies.insert(rb.clone()); let h2 = bodies.insert(rb.clone()); // The same but with a kinematic body. - let rb = RigidBodyBuilder::new_kinematic_position_based().build(); + let rb = RigidBodyBuilder::kinematic_position_based().build(); let h3 = bodies.insert(rb.clone()); - // The same but with a static body. - let rb = RigidBodyBuilder::new_static().build(); + // The same but with a fixed body. + let rb = RigidBodyBuilder::fixed().build(); let h4 = bodies.insert(rb.clone()); let to_delete = [h1, h2, h3, h4]; @@ -787,7 +787,7 @@ mod test { let mut islands = IslandManager::new(); let mut bodies = RigidBodySet::new(); - let rb = RigidBodyBuilder::new_dynamic().build(); + let rb = RigidBodyBuilder::dynamic().build(); let h1 = bodies.insert(rb.clone()); let h2 = bodies.insert(rb.clone()); let h3 = bodies.insert(rb.clone()); @@ -846,7 +846,7 @@ mod test { let physics_hooks = (); let event_handler = (); - let body = RigidBodyBuilder::new_dynamic().build(); + let body = RigidBodyBuilder::dynamic().build(); let b_handle = bodies.insert(body); let collider = ColliderBuilder::ball(1.0).build(); let c_handle = colliders.insert_with_parent(collider, b_handle, &mut bodies); diff --git a/src/pipeline/user_changes.rs b/src/pipeline/user_changes.rs index b9c57bd..bd69bb2 100644 --- a/src/pipeline/user_changes.rs +++ b/src/pipeline/user_changes.rs @@ -117,7 +117,7 @@ pub(crate) fn handle_user_changes_to_rigid_bodies( islands.active_kinematic_set.push(*handle); } } - RigidBodyType::Static => {} + RigidBodyType::Fixed => {} } } diff --git a/src_testbed/graphics.rs b/src_testbed/graphics.rs index 8bf787d..847258d 100644 --- a/src_testbed/graphics.rs +++ b/src_testbed/graphics.rs @@ -170,11 +170,11 @@ impl GraphicsManager { &mut self, materials: &mut Assets, handle: RigidBodyHandle, - is_static: bool, + is_fixed: bool, ) -> Point3 { let mut color = self.ground_color; - if !is_static { + if !is_fixed { match self.b2color.get(&handle).cloned() { Some(c) => color = c, None => color = Self::gen_color(&mut self.rand), diff --git a/src_testbed/physx_backend.rs b/src_testbed/physx_backend.rs index 827c81d..2d42a68 100644 --- a/src_testbed/physx_backend.rs +++ b/src_testbed/physx_backend.rs @@ -213,7 +213,7 @@ impl PhysxWorld { rapier2dynamic.insert(rapier_handle, actor); } else { - let actor = physics.create_static(pos, ()).unwrap(); + let actor = physics.create_fixed(pos, ()).unwrap(); rapier2static.insert(rapier_handle, actor); } } @@ -231,7 +231,7 @@ impl PhysxWorld { let rb_handle = link.rigid_body_handle(); let rb = bodies.get(rb_handle).unwrap(); - if is_root && rb.is_static() { + if is_root && rb.is_fixed() { articulation.set_articulation_flag(ArticulationFlag::FixBase, true); } @@ -382,7 +382,7 @@ impl PhysxWorld { ); for (_, actor) in rapier2static { - scene.add_static_actor(actor); + scene.add_fixed_actor(actor); } for (_, actor) in rapier2dynamic { @@ -712,7 +712,7 @@ type PxPhysicsFoundation = PhysicsFoundation; type PxMaterial = physx::material::PxMaterial<()>; type PxShape = physx::shape::PxShape<(), PxMaterial>; type PxArticulationLink = physx::articulation_link::PxArticulationLink; -type PxRigidStatic = physx::rigid_static::PxRigidStatic<(), PxShape>; +type PxRigidStatic = physx::rigid_fixed::PxRigidStatic<(), PxShape>; type PxRigidDynamic = physx::rigid_dynamic::PxRigidDynamic; type PxArticulation = physx::articulation::PxArticulation<(), PxArticulationLink>; type PxArticulationReducedCoordinate = diff --git a/src_testbed/testbed.rs b/src_testbed/testbed.rs index 7fce70d..cd0ff3a 100644 --- a/src_testbed/testbed.rs +++ b/src_testbed/testbed.rs @@ -668,7 +668,7 @@ impl<'a, 'b, 'c, 'd, 'e, 'f> Testbed<'a, 'b, 'c, 'd, 'e, 'f> { .physics .bodies .iter() - .filter(|e| !e.1.is_static()) + .filter(|e| !e.1.is_fixed()) .map(|e| e.0) .collect(); let num_to_delete = (dynamic_bodies.len() / 10).max(1); @@ -773,7 +773,7 @@ impl<'a, 'b, 'c, 'd, 'e, 'f> Testbed<'a, 'b, 'c, 'd, 'e, 'f> { // // let collider = ColliderBuilder::cuboid(4.0, 2.0, 0.4).density(20.0).build(); // // let collider = ColliderBuilder::ball(2.0).density(1.0).build(); - // let body = RigidBodyBuilder::new_dynamic() + // let body = RigidBodyBuilder::dynamic() // .position(cam_pos) // .linvel(vel.x, vel.y, vel.z) // .ccd_enabled(true)