Skip to content

Commit

Permalink
Collisions happen in fixed update
Browse files Browse the repository at this point in the history
  • Loading branch information
ManevilleF committed Oct 25, 2023
1 parent bb7206c commit d080e75
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 8 deletions.
2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ default-features = false
features = ["dim3", "async-collider"]

[dev-dependencies]
bevy-inspector-egui = "0.19"
bevy-inspector-egui = "0.20"
bevy_rapier3d = "0.22"
rand = "0.8"

Expand Down
10 changes: 3 additions & 7 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -334,13 +334,9 @@ impl Plugin for ClothPlugin {
),
);
#[cfg(feature = "rapier_collisions")]
app.register_type::<ClothCollider>().add_systems(
Update,
(
systems::collisions::init_cloth_collider,
systems::collisions::handle_collisions.before(systems::cloth::render),
),
);
app.register_type::<ClothCollider>()
.add_systems(Update, systems::collisions::init_cloth_collider)
.add_systems(FixedUpdate, systems::collisions::handle_collisions);
bevy::log::info!("Loaded Cloth Plugin");
}
}
1 change: 1 addition & 0 deletions src/systems/cloth.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ pub fn render(
if let Some(mesh) = meshes.get_mut(handle) {
rendering.update_positions(cloth.compute_vertex_positions(transform));
rendering.apply(mesh);
// TODO set_if_neq
*aabb = rendering.compute_aabb();
} else {
log::warn!("A Cloth has a `ClothRendering` component without a loaded mesh handle");
Expand Down

0 comments on commit d080e75

Please sign in to comment.