Skip to content

Commit

Permalink
Rename MassModified to MassModifiedEvent
Browse files Browse the repository at this point in the history
  • Loading branch information
sebcrozet committed Aug 6, 2023
1 parent 37a099d commit 8e55d8d
Show file tree
Hide file tree
Showing 4 changed files with 10 additions and 9 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
### Fix
- Fix debug-renderer lagging one frame behind.
- Fix Collider `Transform` rotation change not being taken into account by the physics engine.
- Fix automatic update of `ReadMassProperties`.

## 0.22.0 (10 July 2023)
### Modified
Expand Down
4 changes: 2 additions & 2 deletions src/dynamics/rigid_body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,9 +172,9 @@ impl ReadMassProperties {

/// Entity that likely had their mass properties changed this frame.
#[derive(Deref, Copy, Clone, Debug, PartialEq, Event)]
pub struct MassModified(pub Entity);
pub struct MassModifiedEvent(pub Entity);

impl From<Entity> for MassModified {
impl From<Entity> for MassModifiedEvent {
fn from(entity: Entity) -> Self {
Self(entity)
}
Expand Down
4 changes: 2 additions & 2 deletions src/plugin/plugin.rs
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ where
systems::update_colliding_entities,
systems::writeback_rigid_bodies,
systems::writeback_mass_properties,
Events::<MassModified>::update_system.after(systems::writeback_mass_properties),
Events::<MassModifiedEvent>::update_system.after(systems::writeback_mass_properties),
)
.into_configs(),
}
Expand Down Expand Up @@ -199,7 +199,7 @@ where
})
.insert_resource(Events::<CollisionEvent>::default())
.insert_resource(Events::<ContactForceEvent>::default())
.insert_resource(Events::<MassModified>::default());
.insert_resource(Events::<MassModifiedEvent>::default());

// Add each set as necessary
if self.default_system_setup {
Expand Down
10 changes: 5 additions & 5 deletions src/plugin/systems.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ use crate::plugin::configuration::{SimulationToRenderTime, TimestepMode};
use crate::plugin::{RapierConfiguration, RapierContext};
use crate::prelude::{
BevyPhysicsHooks, BevyPhysicsHooksAdapter, CollidingEntities, KinematicCharacterController,
KinematicCharacterControllerOutput, MassModified, RigidBodyDisabled,
KinematicCharacterControllerOutput, MassModifiedEvent, RigidBodyDisabled,
};
use crate::utils;
use bevy::ecs::system::{StaticSystemParam, SystemParamItem};
Expand Down Expand Up @@ -155,7 +155,7 @@ pub fn apply_collider_user_changes(
Changed<ColliderMassProperties>,
>,

mut mass_modified: EventWriter<MassModified>,
mut mass_modified: EventWriter<MassModifiedEvent>,
) {
let scale = context.physics_scale;

Expand Down Expand Up @@ -304,7 +304,7 @@ pub fn apply_rigid_body_user_changes(
Changed<RigidBodyDisabled>,
>,

mut mass_modified: EventWriter<MassModified>,
mut mass_modified: EventWriter<MassModifiedEvent>,
) {
let context = &mut *context;
let scale = context.physics_scale;
Expand Down Expand Up @@ -676,7 +676,7 @@ pub fn writeback_mass_properties(
config: Res<RapierConfiguration>,

mut mass_props: Query<&mut ReadMassProperties>,
mut mass_modified: EventReader<MassModified>,
mut mass_modified: EventReader<MassModifiedEvent>,
) {
let context = &mut *context;
let scale = context.physics_scale;
Expand Down Expand Up @@ -1181,7 +1181,7 @@ pub fn sync_removals(
mut removed_rigid_body_disabled: RemovedComponents<RigidBodyDisabled>,
mut removed_colliders_disabled: RemovedComponents<ColliderDisabled>,

mut mass_modified: EventWriter<MassModified>,
mut mass_modified: EventWriter<MassModifiedEvent>,
) {
/*
* Rigid-bodies removal detection.
Expand Down

0 comments on commit 8e55d8d

Please sign in to comment.