Rename rigid-body static to fixed
This commit is contained in:
committed by
Sébastien Crozet
parent
db6a8c526d
commit
a9e3441ecd
@@ -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::<f32>() * 10.0 - 5.0;
|
||||
let y = rand::random::<f32>() * 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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 = [
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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
|
||||
};
|
||||
|
||||
@@ -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();
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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 {
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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);
|
||||
|
||||
@@ -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
|
||||
|
||||
@@ -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);
|
||||
|
||||
Reference in New Issue
Block a user