From fb9094ce8a06cc3ca8ddec1bbe82b8f3ba2b5265 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?F=C3=A9lix=20Lescaudey=20de=20Maneville?= Date: Wed, 10 Jul 2024 10:11:59 +0200 Subject: [PATCH] Physics fix (#25) --- Cargo.toml | 6 +++--- src/components/cloth.rs | 2 +- src/config.rs | 2 +- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 2bb68b1..5976282 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -27,7 +27,7 @@ default-features = false features = ["bevy_render", "bevy_asset"] [dependencies.bevy_rapier3d] -version = "0.25" +version = "0.26" optional = true default-features = false features = ["dim3", "async-collider"] @@ -39,10 +39,10 @@ default-features = false features = ["3d", "f32", "async-collider", "default-collider", "parry-f32"] [dev-dependencies] -bevy-inspector-egui = "0.23" +bevy-inspector-egui = "0.24" rand = "0.8" bevy_xpbd_3d = "0.4" -bevy_rapier3d = "0.25" +bevy_rapier3d = "0.26" [dev-dependencies.bevy] version = "0.13" diff --git a/src/components/cloth.rs b/src/components/cloth.rs index 599a8c1..8876fa1 100644 --- a/src/components/cloth.rs +++ b/src/components/cloth.rs @@ -246,7 +246,7 @@ impl Cloth { .previous_point_positions .get(i) .map_or(Vec3::ZERO, |prev| *point - *prev); - *point += velocity * friction + acceleration; + *point += velocity * friction + acceleration * friction; } } self.previous_point_positions = position_cache; diff --git a/src/config.rs b/src/config.rs index 67d46f2..76da488 100644 --- a/src/config.rs +++ b/src/config.rs @@ -97,7 +97,7 @@ impl Default for ClothConfig { fn default() -> Self { Self { gravity: Vec3::Y * Self::DEFAULT_GRAVITY, - friction: 0.02, + friction: 0.01, sticks_computation_depth: 5, acceleration_smoothing: Default::default(), }