Skip to content

Commit

Permalink
Rename Collider ball -> circle (2D) & sphere (3D), cuboid -> rectan…
Browse files Browse the repository at this point in the history
…gle (2D)
  • Loading branch information
Jondolf committed Feb 17, 2024
1 parent 00ecf1d commit 620b28c
Show file tree
Hide file tree
Showing 29 changed files with 223 additions and 124 deletions.
2 changes: 1 addition & 1 deletion crates/bevy_xpbd_2d/examples/chain_2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ fn setup(
let current_particle = commands
.spawn((
RigidBody::Dynamic,
MassPropertiesBundle::new_computed(&Collider::ball(particle_radius), 1.0),
MassPropertiesBundle::new_computed(&Collider::circle(particle_radius), 1.0),
MaterialMesh2dBundle {
mesh: particle_mesh.clone(),
material: particle_material.clone(),
Expand Down
8 changes: 4 additions & 4 deletions crates/bevy_xpbd_2d/examples/collision_layers.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ fn setup(
..default()
},
RigidBody::Static,
Collider::cuboid(500.0, 25.0),
Collider::rectangle(500.0, 25.0),
CollisionLayers::new([Layer::Blue], [Layer::Blue]),
));

Expand All @@ -55,7 +55,7 @@ fn setup(
..default()
},
RigidBody::Static,
Collider::cuboid(500.0, 25.0),
Collider::rectangle(500.0, 25.0),
CollisionLayers::new([Layer::Red], [Layer::Red]),
));

Expand All @@ -78,7 +78,7 @@ fn setup(
..default()
},
RigidBody::Dynamic,
Collider::ball(marble_radius as Scalar),
Collider::circle(marble_radius as Scalar),
CollisionLayers::new([Layer::Blue], [Layer::Blue]),
));
}
Expand All @@ -100,7 +100,7 @@ fn setup(
..default()
},
RigidBody::Dynamic,
Collider::ball(marble_radius as Scalar),
Collider::circle(marble_radius as Scalar),
CollisionLayers::new([Layer::Red], [Layer::Red]),
));
}
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_xpbd_2d/examples/distance_joint_2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ fn setup(mut commands: Commands) {
..default()
},
RigidBody::Dynamic,
MassPropertiesBundle::new_computed(&Collider::cuboid(50.0, 50.0), 1.0),
MassPropertiesBundle::new_computed(&Collider::rectangle(50.0, 50.0), 1.0),
))
.id();

Expand Down
12 changes: 6 additions & 6 deletions crates/bevy_xpbd_2d/examples/dynamic_character_2d/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ fn setup(
..default()
},
RigidBody::Dynamic,
Collider::cuboid(30.0, 30.0),
Collider::rectangle(30.0, 30.0),
));

// Platforms
Expand All @@ -91,7 +91,7 @@ fn setup(
..default()
},
RigidBody::Static,
Collider::cuboid(1100.0, 50.0),
Collider::rectangle(1100.0, 50.0),
));
commands.spawn((
SpriteBundle {
Expand All @@ -104,7 +104,7 @@ fn setup(
..default()
},
RigidBody::Static,
Collider::cuboid(300.0, 25.0),
Collider::rectangle(300.0, 25.0),
));
commands.spawn((
SpriteBundle {
Expand All @@ -117,7 +117,7 @@ fn setup(
..default()
},
RigidBody::Static,
Collider::cuboid(300.0, 25.0),
Collider::rectangle(300.0, 25.0),
));
commands.spawn((
SpriteBundle {
Expand All @@ -130,7 +130,7 @@ fn setup(
..default()
},
RigidBody::Static,
Collider::cuboid(150.0, 80.0),
Collider::rectangle(150.0, 80.0),
));
commands.spawn((
SpriteBundle {
Expand All @@ -143,7 +143,7 @@ fn setup(
..default()
},
RigidBody::Static,
Collider::cuboid(150.0, 80.0),
Collider::rectangle(150.0, 80.0),
));

// Ramps
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_xpbd_2d/examples/fixed_joint_2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fn setup(mut commands: Commands) {
..default()
},
RigidBody::Dynamic,
MassPropertiesBundle::new_computed(&Collider::cuboid(50.0, 50.0), 1.0),
MassPropertiesBundle::new_computed(&Collider::rectangle(50.0, 50.0), 1.0),
))
.id();

Expand Down
12 changes: 6 additions & 6 deletions crates/bevy_xpbd_2d/examples/kinematic_character_2d/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ fn setup(
..default()
},
RigidBody::Dynamic,
Collider::cuboid(30.0, 30.0),
Collider::rectangle(30.0, 30.0),
));

// Platforms
Expand All @@ -84,7 +84,7 @@ fn setup(
..default()
},
RigidBody::Static,
Collider::cuboid(1100.0, 50.0),
Collider::rectangle(1100.0, 50.0),
));
commands.spawn((
SpriteBundle {
Expand All @@ -97,7 +97,7 @@ fn setup(
..default()
},
RigidBody::Static,
Collider::cuboid(300.0, 25.0),
Collider::rectangle(300.0, 25.0),
));
commands.spawn((
SpriteBundle {
Expand All @@ -110,7 +110,7 @@ fn setup(
..default()
},
RigidBody::Static,
Collider::cuboid(300.0, 25.0),
Collider::rectangle(300.0, 25.0),
));
commands.spawn((
SpriteBundle {
Expand All @@ -123,7 +123,7 @@ fn setup(
..default()
},
RigidBody::Static,
Collider::cuboid(150.0, 80.0),
Collider::rectangle(150.0, 80.0),
));
commands.spawn((
SpriteBundle {
Expand All @@ -136,7 +136,7 @@ fn setup(
..default()
},
RigidBody::Static,
Collider::cuboid(150.0, 80.0),
Collider::rectangle(150.0, 80.0),
));

// Ramps
Expand Down
18 changes: 9 additions & 9 deletions crates/bevy_xpbd_2d/examples/many_shapes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fn setup(
..default()
},
RigidBody::Static,
Collider::cuboid(50.0, 50.0),
Collider::rectangle(50.0, 50.0),
));
// Floor
commands.spawn((
Expand All @@ -51,7 +51,7 @@ fn setup(
..default()
},
RigidBody::Static,
Collider::cuboid(50.0, 50.0),
Collider::rectangle(50.0, 50.0),
));
// Left wall
commands.spawn((
Expand All @@ -62,7 +62,7 @@ fn setup(
..default()
},
RigidBody::Static,
Collider::cuboid(50.0, 50.0),
Collider::rectangle(50.0, 50.0),
));
// Right wall
commands.spawn((
Expand All @@ -73,16 +73,16 @@ fn setup(
..default()
},
RigidBody::Static,
Collider::cuboid(50.0, 50.0),
Collider::rectangle(50.0, 50.0),
));

let ball = (
Collider::ball(7.5),
let circle = (
Collider::circle(7.5),
meshes.add(shape::Circle::new(7.5)).into(),
materials.add(Color::rgb(0.29, 0.33, 0.64)),
);
let cuboid = (
Collider::cuboid(15.0, 15.0),
let rectangle = (
Collider::rectangle(15.0, 15.0),
meshes.add(shape::Box::new(15.0, 15.0, 15.0)).into(),
materials.add(Color::rgb(0.47, 0.58, 0.8)),
);
Expand All @@ -109,7 +109,7 @@ fn setup(
meshes.add(shape::RegularPolygon::new(10.0, 3)).into(),
materials.add(Color::rgb(0.77, 0.87, 0.97)),
);
let shapes = [ball, cuboid, capsule, triangle];
let shapes = [circle, rectangle, capsule, triangle];

for x in -12_i32..12 {
for y in -8_i32..8 {
Expand Down
10 changes: 5 additions & 5 deletions crates/bevy_xpbd_2d/examples/move_marbles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fn setup(
..default()
},
RigidBody::Static,
Collider::cuboid(50.0, 50.0),
Collider::rectangle(50.0, 50.0),
));
// Floor
commands.spawn((
Expand All @@ -51,7 +51,7 @@ fn setup(
..default()
},
RigidBody::Static,
Collider::cuboid(50.0, 50.0),
Collider::rectangle(50.0, 50.0),
));
// Left wall
commands.spawn((
Expand All @@ -62,7 +62,7 @@ fn setup(
..default()
},
RigidBody::Static,
Collider::cuboid(50.0, 50.0),
Collider::rectangle(50.0, 50.0),
));
// Right wall
commands.spawn((
Expand All @@ -73,7 +73,7 @@ fn setup(
..default()
},
RigidBody::Static,
Collider::cuboid(50.0, 50.0),
Collider::rectangle(50.0, 50.0),
));

let marble_radius = 5.0;
Expand All @@ -95,7 +95,7 @@ fn setup(
..default()
},
RigidBody::Dynamic,
Collider::ball(marble_radius as Scalar),
Collider::circle(marble_radius as Scalar),
Marble,
));
}
Expand Down
12 changes: 6 additions & 6 deletions crates/bevy_xpbd_2d/examples/one_way_platform_2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ fn setup(
..default()
},
RigidBody::Static,
Collider::cuboid(50.0, 50.0),
Collider::rectangle(50.0, 50.0),
));
// Floor
commands.spawn((
Expand All @@ -77,7 +77,7 @@ fn setup(
..default()
},
RigidBody::Static,
Collider::cuboid(50.0, 50.0),
Collider::rectangle(50.0, 50.0),
));
// Left wall
commands.spawn((
Expand All @@ -88,7 +88,7 @@ fn setup(
..default()
},
RigidBody::Static,
Collider::cuboid(50.0, 50.0),
Collider::rectangle(50.0, 50.0),
));
// Right wall
commands.spawn((
Expand All @@ -99,7 +99,7 @@ fn setup(
..default()
},
RigidBody::Static,
Collider::cuboid(50.0, 50.0),
Collider::rectangle(50.0, 50.0),
));

// For one-way platforms
Expand All @@ -119,7 +119,7 @@ fn setup(
..default()
},
RigidBody::Static,
Collider::cuboid(50.0, 50.0),
Collider::rectangle(50.0, 50.0),
OneWayPlatform::default(),
));
}
Expand All @@ -137,7 +137,7 @@ fn setup(
RigidBody::Dynamic,
LockedAxes::ROTATION_LOCKED,
Restitution::ZERO.with_combine_rule(CoefficientCombine::Min),
Collider::cuboid(actor_size.x, actor_size.y),
Collider::rectangle(actor_size.x, actor_size.y),
Actor,
PassThroughOneWayPlatform::ByNormal,
MovementSpeed(250.0),
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_xpbd_2d/examples/prismatic_joint_2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fn setup(mut commands: Commands) {
..default()
},
RigidBody::Dynamic,
MassPropertiesBundle::new_computed(&Collider::cuboid(50.0, 50.0), 1.0),
MassPropertiesBundle::new_computed(&Collider::rectangle(50.0, 50.0), 1.0),
))
.id();

Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_xpbd_2d/examples/ray_caster.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ fn setup(
),
..default()
},
Collider::ball(radius as Scalar),
Collider::circle(radius as Scalar),
));
}
}
Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_xpbd_2d/examples/revolute_joint_2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ fn setup(mut commands: Commands) {
..default()
},
RigidBody::Dynamic,
MassPropertiesBundle::new_computed(&Collider::cuboid(50.0, 50.0), 1.0),
MassPropertiesBundle::new_computed(&Collider::rectangle(50.0, 50.0), 1.0),
))
.id();

Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_xpbd_2d/examples/sensor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -71,7 +71,7 @@ fn setup(
PressurePlate,
Sensor,
RigidBody::Static,
Collider::cuboid(100.0, 100.0),
Collider::rectangle(100.0, 100.0),
Name::new("Pressure Plate"),
));

Expand Down
2 changes: 1 addition & 1 deletion crates/bevy_xpbd_3d/examples/chain_3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ fn setup(
let current_particle = commands
.spawn((
RigidBody::Dynamic,
MassPropertiesBundle::new_computed(&Collider::ball(particle_radius), 1.0),
MassPropertiesBundle::new_computed(&Collider::sphere(particle_radius), 1.0),
PbrBundle {
mesh: particle_mesh.clone(),
material: particle_material.clone(),
Expand Down
Loading

0 comments on commit 620b28c

Please sign in to comment.