Skip to content

Commit

Permalink
Merge pull request #43 from Jondolf/longer-component-names
Browse files Browse the repository at this point in the history
Rename names to be more readable
  • Loading branch information
Jondolf authored Jun 17, 2023
2 parents 2928de0 + 3d2edfe commit 029b041
Show file tree
Hide file tree
Showing 39 changed files with 545 additions and 478 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,8 +59,8 @@ fn setup(
..default()
},
RigidBody::Dynamic,
Pos(Vec3::Y * 4.0),
AngVel(Vec3::new(2.5, 3.4, 1.6)),
Position(Vec3::Y * 4.0),
AngularVelocity(Vec3::new(2.5, 3.4, 1.6)),
Collider::cuboid(1.0, 1.0, 1.0),
));
// Light
Expand Down
10 changes: 5 additions & 5 deletions crates/bevy_xpbd_2d/examples/chain2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,8 +80,8 @@ fn create_chain(
..default()
},
RigidBody::Dynamic,
Pos(Vec2::Y * -(node_size + node_dist) * i as f32),
MassPropsBundle::new_computed(&Collider::ball(node_size * 0.5), 1.0),
Position(Vec2::Y * -(node_size + node_dist) * i as f32),
MassPropertiesBundle::new_computed(&Collider::ball(node_size * 0.5), 1.0),
))
.id();

Expand Down Expand Up @@ -119,7 +119,7 @@ fn mouse_position(
fn follow_mouse(
mouse_pos: Res<MouseWorldPos>,
buttons: Res<Input<MouseButton>>,
mut query: Query<&mut Pos, With<FollowMouse>>,
mut query: Query<&mut Position, With<FollowMouse>>,
) {
for mut pos in &mut query {
if buttons.pressed(MouseButton::Left) {
Expand All @@ -135,8 +135,8 @@ fn main() {
App::new()
.insert_resource(ClearColor(Color::BLACK))
.insert_resource(Msaa::Sample4)
.insert_resource(NumSubsteps(15))
.insert_resource(NumPosIters(6))
.insert_resource(SubstepCount(15))
.insert_resource(IterationCount(6))
.init_resource::<MouseWorldPos>()
.add_plugins(DefaultPlugins)
.add_plugin(XpbdExamplePlugin)
Expand Down
8 changes: 4 additions & 4 deletions crates/bevy_xpbd_2d/examples/fixed_joint_2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ fn setup(
..default()
},
RigidBody::Dynamic,
Pos(Vec2::X * 1.5),
MassPropsBundle::new_computed(&Collider::cuboid(1.0, 1.0), 1.0),
Position(Vec2::X * 1.5),
MassPropertiesBundle::new_computed(&Collider::cuboid(1.0, 1.0), 1.0),
))
.id();

Expand All @@ -62,7 +62,7 @@ fn setup(

fn player_movement(
keyboard_input: Res<Input<KeyCode>>,
mut query: Query<(&mut LinVel, &mut AngVel, &MoveSpeed), With<Player>>,
mut query: Query<(&mut LinearVelocity, &mut AngularVelocity, &MoveSpeed), With<Player>>,
) {
for (mut lin_vel, mut ang_vel, move_speed) in &mut query {
lin_vel.0 *= 0.95;
Expand Down Expand Up @@ -95,7 +95,7 @@ fn main() {
App::new()
.insert_resource(ClearColor(Color::rgb(0.0, 0.0, 0.1)))
.insert_resource(Msaa::Sample4)
.insert_resource(NumSubsteps(50))
.insert_resource(SubstepCount(50))
.add_plugins(DefaultPlugins)
.add_plugin(XpbdExamplePlugin)
.add_startup_system(setup)
Expand Down
14 changes: 7 additions & 7 deletions crates/bevy_xpbd_2d/examples/move_marbles.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ fn setup(
..default()
},
RigidBody::Static,
Pos(Vec2::NEG_Y * 7.5),
Position(Vec2::NEG_Y * 7.5),
Collider::cuboid(20.0, 1.0),
));

Expand All @@ -63,7 +63,7 @@ fn setup(
..default()
},
RigidBody::Static,
Pos(Vec2::Y * 7.5),
Position(Vec2::Y * 7.5),
Collider::cuboid(20.0, 1.0),
));

Expand All @@ -75,7 +75,7 @@ fn setup(
..default()
},
RigidBody::Static,
Pos(Vec2::NEG_X * 9.5),
Position(Vec2::NEG_X * 9.5),
Collider::cuboid(1.0, 20.0),
));

Expand All @@ -87,7 +87,7 @@ fn setup(
..default()
},
RigidBody::Static,
Pos(Vec2::X * 9.5),
Position(Vec2::X * 9.5),
Collider::cuboid(1.0, 20.0),
));

Expand All @@ -107,7 +107,7 @@ fn setup(
..default()
},
RigidBody::Dynamic,
Pos(pos),
Position(pos),
Collider::ball(radius),
Player,
MoveAcceleration(0.5),
Expand Down Expand Up @@ -144,7 +144,7 @@ fn handle_input(keyboard_input: Res<Input<KeyCode>>, mut ev_movement: EventWrite

fn player_movement(
mut ev_movement: EventReader<MovementEvent>,
mut query: Query<(&mut LinVel, &MaxVelocity, &MoveAcceleration), With<Player>>,
mut query: Query<(&mut LinearVelocity, &MaxVelocity, &MoveAcceleration), With<Player>>,
) {
for ev in ev_movement.iter() {
for (mut vel, max_vel, move_acceleration) in &mut query {
Expand All @@ -166,7 +166,7 @@ fn main() {
App::new()
.insert_resource(ClearColor(Color::BLACK))
.insert_resource(Msaa::Sample4)
.insert_resource(NumSubsteps(6))
.insert_resource(SubstepCount(6))
.add_plugins(DefaultPlugins)
.add_plugin(XpbdExamplePlugin)
.add_event::<MovementEvent>()
Expand Down
8 changes: 4 additions & 4 deletions crates/bevy_xpbd_2d/examples/prismatic_joint_2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ fn setup(
..default()
},
RigidBody::Dynamic,
Pos(Vec2::X * 1.5),
MassPropsBundle::new_computed(&Collider::cuboid(1.0, 1.0), 1.0),
Position(Vec2::X * 1.5),
MassPropertiesBundle::new_computed(&Collider::cuboid(1.0, 1.0), 1.0),
))
.id();

Expand All @@ -67,7 +67,7 @@ fn setup(

fn player_movement(
keyboard_input: Res<Input<KeyCode>>,
mut query: Query<(&mut LinVel, &MoveSpeed), With<Player>>,
mut query: Query<(&mut LinearVelocity, &MoveSpeed), With<Player>>,
) {
for (mut vel, move_speed) in &mut query {
vel.0 *= 0.95;
Expand All @@ -93,7 +93,7 @@ fn main() {
App::new()
.insert_resource(ClearColor(Color::rgb(0.0, 0.0, 0.1)))
.insert_resource(Msaa::Sample4)
.insert_resource(NumSubsteps(50))
.insert_resource(SubstepCount(50))
.add_plugins(DefaultPlugins)
.add_plugin(XpbdExamplePlugin)
.add_startup_system(setup)
Expand Down
8 changes: 4 additions & 4 deletions crates/bevy_xpbd_2d/examples/revolute_joint_2d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ fn setup(
..default()
},
RigidBody::Dynamic,
Pos(Vec2::NEG_Y * 3.0),
MassPropsBundle::new_computed(&Collider::cuboid(1.0, 1.0), 1.0),
Position(Vec2::NEG_Y * 3.0),
MassPropertiesBundle::new_computed(&Collider::cuboid(1.0, 1.0), 1.0),
))
.id();

Expand All @@ -67,7 +67,7 @@ fn setup(

fn player_movement(
keyboard_input: Res<Input<KeyCode>>,
mut query: Query<(&mut LinVel, &MoveSpeed), With<Player>>,
mut query: Query<(&mut LinearVelocity, &MoveSpeed), With<Player>>,
) {
for (mut vel, move_speed) in &mut query {
vel.0 *= 0.95;
Expand All @@ -93,7 +93,7 @@ fn main() {
App::new()
.insert_resource(ClearColor(Color::rgb(0.0, 0.0, 0.1)))
.insert_resource(Msaa::Sample4)
.insert_resource(NumSubsteps(50))
.insert_resource(SubstepCount(50))
.add_plugins(DefaultPlugins)
.add_plugin(XpbdExamplePlugin)
.add_startup_system(setup)
Expand Down
12 changes: 6 additions & 6 deletions crates/bevy_xpbd_3d/examples/chain3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ fn setup(
..default()
},
RigidBody::Static,
Pos(Vec3::NEG_Y * 18.0),
Position(Vec3::NEG_Y * 18.0),
Collider::cuboid(floor_size.x, floor_size.y, floor_size.z),
));

Expand Down Expand Up @@ -117,7 +117,7 @@ fn create_chain(
..default()
},
RigidBody::Kinematic,
Pos(start_pos),
Position(start_pos),
Player,
MoveSpeed(0.3),
))
Expand All @@ -134,8 +134,8 @@ fn create_chain(
..default()
},
RigidBody::Dynamic,
Pos(start_pos + delta_pos * i as f32),
MassPropsBundle::new_computed(&Collider::ball(node_size * 0.5), 1.0),
Position(start_pos + delta_pos * i as f32),
MassPropertiesBundle::new_computed(&Collider::ball(node_size * 0.5), 1.0),
))
.id();

Expand All @@ -151,7 +151,7 @@ fn create_chain(

fn player_movement(
keyboard_input: Res<Input<KeyCode>>,
mut query: Query<(&mut LinVel, &MoveSpeed), With<Player>>,
mut query: Query<(&mut LinearVelocity, &MoveSpeed), With<Player>>,
) {
for (mut vel, move_speed) in &mut query {
vel.0 *= 0.95;
Expand Down Expand Up @@ -183,7 +183,7 @@ fn main() {
App::new()
.insert_resource(ClearColor(Color::rgb(0.0, 0.0, 0.1)))
.insert_resource(Msaa::Sample4)
.insert_resource(NumSubsteps(50))
.insert_resource(SubstepCount(50))
.add_plugins(DefaultPlugins)
.add_plugin(XpbdExamplePlugin)
.add_startup_system(setup)
Expand Down
6 changes: 3 additions & 3 deletions crates/bevy_xpbd_3d/examples/cubes.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ fn setup(
..default()
},
RigidBody::Static,
Pos(Vec3::NEG_Y),
Position(Vec3::NEG_Y),
Collider::cuboid(floor_size.x, floor_size.y, floor_size.z),
));

Expand All @@ -61,7 +61,7 @@ fn setup(
..default()
},
RigidBody::Dynamic,
Pos(pos + Vec3::Y * 5.0),
Position(pos + Vec3::Y * 5.0),
Collider::cuboid(radius * 2.0, radius * 2.0, radius * 2.0),
Player,
MoveAcceleration(0.1),
Expand Down Expand Up @@ -100,7 +100,7 @@ fn setup(

fn player_movement(
keyboard_input: Res<Input<KeyCode>>,
mut query: Query<(&mut LinVel, &MaxLinearVelocity, &MoveAcceleration), With<Player>>,
mut query: Query<(&mut LinearVelocity, &MaxLinearVelocity, &MoveAcceleration), With<Player>>,
) {
for (mut lin_vel, max_vel, move_acceleration) in &mut query {
if keyboard_input.pressed(KeyCode::Up) {
Expand Down
6 changes: 3 additions & 3 deletions crates/bevy_xpbd_3d/examples/cubes_f64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ fn setup(
..default()
},
RigidBody::Static,
Pos(DVec3::NEG_Y),
Position(DVec3::NEG_Y),
Collider::cuboid(floor_size.x, floor_size.y, floor_size.z),
));

Expand All @@ -61,7 +61,7 @@ fn setup(
..default()
},
RigidBody::Dynamic,
Pos(pos + DVec3::Y * 5.0),
Position(pos + DVec3::Y * 5.0),
Collider::cuboid(radius * 2.0, radius * 2.0, radius * 2.0),
Player,
MoveAcceleration(0.1),
Expand Down Expand Up @@ -100,7 +100,7 @@ fn setup(

fn player_movement(
keyboard_input: Res<Input<KeyCode>>,
mut query: Query<(&mut LinVel, &MaxLinearVelocity, &MoveAcceleration), With<Player>>,
mut query: Query<(&mut LinearVelocity, &MaxLinearVelocity, &MoveAcceleration), With<Player>>,
) {
for (mut lin_vel, max_vel, move_acceleration) in &mut query {
if keyboard_input.pressed(KeyCode::Up) {
Expand Down
4 changes: 2 additions & 2 deletions crates/bevy_xpbd_3d/examples/custom_broad_phase.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ fn setup(
..default()
},
RigidBody::Dynamic,
Pos(Vec3::Y * 4.0),
AngVel(Vec3::new(2.5, 3.4, 1.6)),
Position(Vec3::Y * 4.0),
AngularVelocity(Vec3::new(2.5, 3.4, 1.6)),
Collider::cuboid(1.0, 1.0, 1.0),
));
// Light
Expand Down
9 changes: 4 additions & 5 deletions crates/bevy_xpbd_3d/examples/custom_constraint.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,7 @@ fn main() {
.get_schedule_mut(SubstepSchedule)
.expect("add SubstepSchedule first");
substeps.add_system(
solve_constraint::<CustomDistanceConstraint, 2>
.in_set(SubsteppingSet::SolveUserConstraints),
solve_constraint::<CustomDistanceConstraint, 2>.in_set(SubstepSet::SolveUserConstraints),
);

// Run the app
Expand Down Expand Up @@ -48,7 +47,7 @@ impl XpbdConstraint<2> for CustomDistanceConstraint {
let [r1, r2] = [Vector::ZERO, Vector::ZERO];

// Compute the positional difference
let delta_x = body1.pos.0 - body2.pos.0;
let delta_x = body1.position.0 - body2.position.0;

// The current separation distance
let length = delta_x.length();
Expand Down Expand Up @@ -101,8 +100,8 @@ fn setup(
.spawn((
cube_mesh,
RigidBody::Dynamic,
Pos(Vec3::new(3.0, 3.5, 0.0)),
MassPropsBundle::new_computed(&Collider::cuboid(1.0, 1.0, 1.0), 1.0),
Position(Vec3::new(3.0, 3.5, 0.0)),
MassPropertiesBundle::new_computed(&Collider::cuboid(1.0, 1.0, 1.0), 1.0),
))
.id();

Expand Down
8 changes: 4 additions & 4 deletions crates/bevy_xpbd_3d/examples/fixed_joint_3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ fn setup(
..default()
},
RigidBody::Dynamic,
Pos(Vec3::X * 1.5),
MassPropsBundle::new_computed(&Collider::cuboid(1.0, 1.0, 1.0), 1.0),
Position(Vec3::X * 1.5),
MassPropertiesBundle::new_computed(&Collider::cuboid(1.0, 1.0, 1.0), 1.0),
))
.id();

Expand Down Expand Up @@ -76,7 +76,7 @@ fn setup(

fn player_movement(
keyboard_input: Res<Input<KeyCode>>,
mut query: Query<(&mut LinVel, &mut AngVel, &MoveSpeed), With<Player>>,
mut query: Query<(&mut LinearVelocity, &mut AngularVelocity, &MoveSpeed), With<Player>>,
) {
for (mut lin_vel, mut ang_vel, move_speed) in &mut query {
lin_vel.0 *= 0.95;
Expand Down Expand Up @@ -115,7 +115,7 @@ fn main() {
App::new()
.insert_resource(ClearColor(Color::rgb(0.0, 0.0, 0.1)))
.insert_resource(Msaa::Sample4)
.insert_resource(NumSubsteps(50))
.insert_resource(SubstepCount(50))
.add_plugins(DefaultPlugins)
.add_plugin(XpbdExamplePlugin)
.add_startup_system(setup)
Expand Down
8 changes: 4 additions & 4 deletions crates/bevy_xpbd_3d/examples/prismatic_joint_3d.rs
Original file line number Diff line number Diff line change
Expand Up @@ -41,8 +41,8 @@ fn setup(
..default()
},
RigidBody::Dynamic,
Pos(Vec3::X * 1.5),
MassPropsBundle::new_computed(&Collider::cuboid(1.0, 1.0, 1.0), 1.0),
Position(Vec3::X * 1.5),
MassPropertiesBundle::new_computed(&Collider::cuboid(1.0, 1.0, 1.0), 1.0),
))
.id();

Expand Down Expand Up @@ -81,7 +81,7 @@ fn setup(

fn player_movement(
keyboard_input: Res<Input<KeyCode>>,
mut query: Query<(&mut LinVel, &MoveSpeed), With<Player>>,
mut query: Query<(&mut LinearVelocity, &MoveSpeed), With<Player>>,
) {
for (mut vel, move_speed) in &mut query {
vel.0 *= 0.95;
Expand Down Expand Up @@ -113,7 +113,7 @@ fn main() {
App::new()
.insert_resource(ClearColor(Color::rgb(0.0, 0.0, 0.1)))
.insert_resource(Msaa::Sample4)
.insert_resource(NumSubsteps(50))
.insert_resource(SubstepCount(50))
.add_plugins(DefaultPlugins)
.add_plugin(XpbdExamplePlugin)
.add_startup_system(setup)
Expand Down
Loading

0 comments on commit 029b041

Please sign in to comment.