Skip to content

Commit 0c4cfc9

Browse files
committed
Update to rapier 0.31.0 and bevy to 0.17.3
1 parent 9cae03e commit 0c4cfc9

File tree

7 files changed

+40
-71
lines changed

7 files changed

+40
-71
lines changed

bevy_rapier2d/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -64,15 +64,15 @@ async-collider = [
6464
to-bevy-mesh = ["bevy/bevy_render", "bevy/bevy_asset"]
6565

6666
[dependencies]
67-
bevy = { version = "0.17.2", default-features = false, features = ["std"] }
67+
bevy = { version = "0.17.3", default-features = false, features = ["std"] }
6868
nalgebra = { version = "0.34.1", features = ["convert-glam030"] }
69-
rapier2d = "0.30.1"
69+
rapier2d = "0.31.0"
7070
bitflags = "2.10.0"
7171
log = "0.4"
7272
serde = { version = "1", features = ["derive"], optional = true }
7373

7474
[dev-dependencies]
75-
bevy = { version = "0.17.2", default-features = false, features = [
75+
bevy = { version = "0.17.3", default-features = false, features = [
7676
"x11",
7777
"bevy_state",
7878
"bevy_window",

bevy_rapier3d/Cargo.toml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,15 +65,15 @@ async-collider = [
6565
to-bevy-mesh = ["bevy/bevy_render", "bevy/bevy_asset"]
6666

6767
[dependencies]
68-
bevy = { version = "0.17.2", default-features = false, features = ["std"] }
68+
bevy = { version = "0.17.3", default-features = false, features = ["std"] }
6969
nalgebra = { version = "0.34.1", features = ["convert-glam030"] }
70-
rapier3d = "0.30.1"
70+
rapier3d = "0.31.0"
7171
bitflags = "2.10.0"
7272
log = "0.4"
7373
serde = { version = "1", features = ["derive"], optional = true }
7474

7575
[dev-dependencies]
76-
bevy = { version = "0.17.2", default-features = false, features = [
76+
bevy = { version = "0.17.3", default-features = false, features = [
7777
"bevy_window",
7878
"x11",
7979
"tonemapping_luts",

bevy_rapier_benches3d/Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@ edition = "2021"
99
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html
1010

1111
[dependencies]
12-
rapier3d = { features = ["profiler"], version = "0.30.1" }
12+
rapier3d = "0.31.0"
1313
bevy_rapier3d = { version = "0.31", path = "../bevy_rapier3d" }
14-
bevy = { version = "0.17.2", default-features = false }
14+
bevy = { version = "0.17.3", default-features = false }
1515

1616
[dev-dependencies]
1717
divan = "0.1"

ci/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ version = "0.1.0"
44
edition = "2021"
55

66
[dependencies]
7-
bevy = "0.17.2"
7+
bevy = "0.17.3"
88
bevy_rapier3d = { version = "0.31", path = "../bevy_rapier3d" }
99
bevy_rapier2d = { version = "0.31", path = "../bevy_rapier2d" }
1010

src/geometry/collider.rs

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ use bevy::prelude::*;
1010

1111
use bevy::platform::collections::HashSet;
1212
use rapier::geometry::Shape;
13-
use rapier::prelude::{ColliderHandle, InteractionGroups, SharedShape};
13+
use rapier::prelude::{ColliderHandle, InteractionGroups, InteractionTestMode, SharedShape};
1414

1515
use crate::dynamics::{CoefficientCombineRule, MassProperties};
1616
use crate::math::Vect;
@@ -405,6 +405,7 @@ impl From<CollisionGroups> for InteractionGroups {
405405
memberships: rapier::geometry::Group::from_bits(collision_groups.memberships.bits())
406406
.unwrap(),
407407
filter: rapier::geometry::Group::from_bits(collision_groups.filters.bits()).unwrap(),
408+
test_mode: InteractionTestMode::And,
408409
}
409410
}
410411
}
@@ -438,6 +439,7 @@ impl From<SolverGroups> for InteractionGroups {
438439
memberships: rapier::geometry::Group::from_bits(solver_groups.memberships.bits())
439440
.unwrap(),
440441
filter: rapier::geometry::Group::from_bits(solver_groups.filters.bits()).unwrap(),
442+
test_mode: InteractionTestMode::And,
441443
}
442444
}
443445
}

src/plugin/plugin.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
use crate::pipeline::{CollisionEvent, ContactForceEvent};
22
use crate::prelude::*;
3-
use crate::reflect::IntegrationParametersWrapper;
3+
use crate::reflect::{IntegrationParametersWrapper, SpringCoefficientsWrapper};
44
use bevy::app::DynEq;
55
use bevy::ecs::{
66
intern::Interned,
@@ -266,7 +266,8 @@ where
266266
.register_type::<RapierConfiguration>()
267267
.register_type::<SimulationToRenderTime>()
268268
.register_type::<DefaultRapierContext>()
269-
.register_type::<RapierContextInitialization>();
269+
.register_type::<RapierContextInitialization>()
270+
.register_type::<SpringCoefficientsWrapper>();
270271

271272
app.insert_resource(Messages::<CollisionEvent>::default())
272273
.insert_resource(Messages::<ContactForceEvent>::default())

src/reflect/mod.rs

Lines changed: 25 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,9 @@
11
use crate::math::Real;
22
use bevy::reflect::reflect_remote;
3+
use rapier::{dynamics::IntegrationParameters, prelude::SpringCoefficients};
4+
35
#[cfg(feature = "dim3")]
46
use rapier::dynamics::FrictionModel;
5-
use rapier::dynamics::IntegrationParameters;
67

78
/// Friction models used for all contact constraints between two rigid-bodies.
89
///
@@ -27,6 +28,21 @@ pub enum FrictionModelWrapper {
2728
Coulomb,
2829
}
2930

31+
#[reflect_remote(SpringCoefficients<Real>)]
32+
#[derive(Copy, Clone, Debug, PartialEq)]
33+
/// Coefficients for a spring, typically used for configuring constraint softness for contacts and
34+
/// joints.
35+
pub struct SpringCoefficientsWrapper {
36+
/// Sets the natural frequency (Hz) of the spring-like constraint.
37+
///
38+
/// Higher values make the constraint stiffer and resolve constraint violations more quickly.
39+
pub natural_frequency: Real,
40+
/// Sets the damping ratio for the spring-like constraint.
41+
///
42+
/// Larger values make the joint more compliant (allowing more drift before stabilization).
43+
pub damping_ratio: Real,
44+
}
45+
3046
#[cfg(not(feature = "dim3"))]
3147
#[reflect_remote(IntegrationParameters)]
3248
#[derive(Copy, Clone, Debug, PartialEq)]
@@ -46,34 +62,9 @@ pub struct IntegrationParametersWrapper {
4662
/// to numerical instabilities.
4763
pub min_ccd_dt: Real,
4864

49-
/// > 0: the damping ratio used by the springs for contact constraint stabilization.
50-
///
51-
/// Larger values make the constraints more compliant (allowing more visible
52-
/// penetrations before stabilization).
53-
/// (default `5.0`).
54-
pub contact_damping_ratio: Real,
55-
56-
/// > 0: the natural frequency used by the springs for contact constraint regularization.
57-
///
58-
/// Increasing this value will make it so that penetrations get fixed more quickly at the
59-
/// expense of potential jitter effects due to overshooting. In order to make the simulation
60-
/// look stiffer, it is recommended to increase the [`Self::contact_damping_ratio`] instead of this
61-
/// value.
62-
/// (default: `30.0`).
63-
pub contact_natural_frequency: Real,
64-
65-
/// > 0: the natural frequency used by the springs for joint constraint regularization.
66-
///
67-
/// Increasing this value will make it so that penetrations get fixed more quickly.
68-
/// (default: `1.0e6`).
69-
pub joint_natural_frequency: Real,
70-
71-
/// The fraction of critical damping applied to the joint for constraints regularization.
72-
///
73-
/// Larger values make the constraints more compliant (allowing more joint
74-
/// drift before stabilization).
75-
/// (default `1.0`).
76-
pub joint_damping_ratio: Real,
65+
/// Softness coefficients for contact constraints.
66+
#[reflect(remote = SpringCoefficientsWrapper)]
67+
pub contact_softness: SpringCoefficients<Real>,
7768

7869
/// The coefficient in `[0, 1]` applied to warmstart impulses, i.e., impulses that are used as the
7970
/// initial solution (instead of 0) at the next simulation step.
@@ -114,7 +105,7 @@ pub struct IntegrationParametersWrapper {
114105
pub num_solver_iterations: usize,
115106
/// Number of internal Project Gauss Seidel (PGS) iterations run at each solver iteration (default: `1`).
116107
pub num_internal_pgs_iterations: usize,
117-
/// The number of stabilization iterations run at each solver iterations (default: `2`).
108+
/// The number of stabilization iterations run at each solver iterations (default: `1`).
118109
pub num_internal_stabilization_iterations: usize,
119110
/// Minimum number of dynamic bodies in each active island (default: `128`).
120111
pub min_island_size: usize,
@@ -142,34 +133,9 @@ pub struct IntegrationParametersWrapper {
142133
/// to numerical instabilities.
143134
pub min_ccd_dt: Real,
144135

145-
/// > 0: the damping ratio used by the springs for contact constraint stabilization.
146-
///
147-
/// Larger values make the constraints more compliant (allowing more visible
148-
/// penetrations before stabilization).
149-
/// (default `5.0`).
150-
pub contact_damping_ratio: Real,
151-
152-
/// > 0: the natural frequency used by the springs for contact constraint regularization.
153-
///
154-
/// Increasing this value will make it so that penetrations get fixed more quickly at the
155-
/// expense of potential jitter effects due to overshooting. In order to make the simulation
156-
/// look stiffer, it is recommended to increase the [`Self::contact_damping_ratio`] instead of this
157-
/// value.
158-
/// (default: `30.0`).
159-
pub contact_natural_frequency: Real,
160-
161-
/// > 0: the natural frequency used by the springs for joint constraint regularization.
162-
///
163-
/// Increasing this value will make it so that penetrations get fixed more quickly.
164-
/// (default: `1.0e6`).
165-
pub joint_natural_frequency: Real,
166-
167-
/// The fraction of critical damping applied to the joint for constraints regularization.
168-
///
169-
/// Larger values make the constraints more compliant (allowing more joint
170-
/// drift before stabilization).
171-
/// (default `1.0`).
172-
pub joint_damping_ratio: Real,
136+
/// Softness coefficients for contact constraints.
137+
#[reflect(remote = SpringCoefficientsWrapper)]
138+
pub contact_softness: SpringCoefficients<Real>,
173139

174140
/// The coefficient in `[0, 1]` applied to warmstart impulses, i.e., impulses that are used as the
175141
/// initial solution (instead of 0) at the next simulation step.
@@ -210,7 +176,7 @@ pub struct IntegrationParametersWrapper {
210176
pub num_solver_iterations: usize,
211177
/// Number of internal Project Gauss Seidel (PGS) iterations run at each solver iteration (default: `1`).
212178
pub num_internal_pgs_iterations: usize,
213-
/// The number of stabilization iterations run at each solver iterations (default: `2`).
179+
/// The number of stabilization iterations run at each solver iterations (default: `1`).
214180
pub num_internal_stabilization_iterations: usize,
215181
/// Minimum number of dynamic bodies in each active island (default: `128`).
216182
pub min_island_size: usize,

0 commit comments

Comments
 (0)