Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: update to rapier 0.18 #46

Merged
merged 2 commits into from
Feb 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,10 +18,10 @@ salva3d = { path = "./build/salva3d" }
#rapier_testbed2d = { git = "https://github.com/dimforge/rapier", branch = "split_geom" }
#rapier_testbed3d = { git = "https://github.com/dimforge/rapier", branch = "split_geom" }

rapier2d = { git = "https://github.com/dimforge/rapier" }
rapier3d = { git = "https://github.com/dimforge/rapier" }
rapier_testbed2d = { git = "https://github.com/dimforge/rapier" }
rapier_testbed3d = { git = "https://github.com/dimforge/rapier" }
#rapier2d = { git = "https://github.com/dimforge/rapier" }
#rapier3d = { git = "https://github.com/dimforge/rapier" }
#rapier_testbed2d = { git = "https://github.com/dimforge/rapier" }
#rapier_testbed3d = { git = "https://github.com/dimforge/rapier" }

# rapier2d = { git = "https://github.com/dimforge/rapier", rev = "3b0d256" }
# rapier3d = { git = "https://github.com/dimforge/rapier", rev = "3b0d256" }
Expand Down
6 changes: 3 additions & 3 deletions build/salva2d/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "salva2d"
version = "0.8.0"
version = "0.9.0"
authors = [ "Sébastien Crozet <[email protected]>" ]
description = "2-dimensional particle-based fluid dynamics in Rust."
documentation = "https://salva.rs/docs"
Expand Down Expand Up @@ -43,8 +43,8 @@ rayon = { version = "1.8", optional = true }

nalgebra = "0.32"
parry2d = { version = "0.13", optional = true }
rapier2d = { version = "0.17", optional = true }
rapier_testbed2d = { version = "0.17", optional = true }
rapier2d = { version = "0.18", optional = true }
rapier_testbed2d = { version = "0.18", optional = true }

bevy_egui = { version = "0.23", features = ["immutable_ctx"], optional = true }

Expand Down
6 changes: 3 additions & 3 deletions build/salva3d/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "salva3d"
version = "0.8.0"
version = "0.9.0"
authors = [ "Sébastien Crozet <[email protected]>" ]
description = "3-dimensional particle-based fluid dynamics in Rust."
documentation = "https://salva.rs/rustdoc/salva3d/index.html"
Expand Down Expand Up @@ -39,8 +39,8 @@ rayon = { version = "1.8", optional = true }

nalgebra = "0.32"
parry3d = { version = "0.13", optional = true }
rapier3d = { version = "0.17", optional = true }
rapier_testbed3d = { version = "0.17", optional = true }
rapier3d = { version = "0.18", optional = true }
rapier_testbed3d = { version = "0.18", optional = true }

bevy_egui = { version = "0.23", features = ["immutable_ctx"], optional = true }

Expand Down
4 changes: 2 additions & 2 deletions examples2d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ parallel = [ "rapier_testbed2d/parallel"]
Inflector = "0.11"
nalgebra = "0.32"
parry2d = "0.13"
rapier2d = "0.17"
rapier_testbed2d = "0.17"
rapier2d = "0.18"
rapier_testbed2d = "0.18"
parry3d = "0.13"
bevy = "0.12.1"

Expand Down
6 changes: 3 additions & 3 deletions examples2d/basic2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -100,7 +100,7 @@ pub fn init_world(testbed: &mut Testbed) {
);

/*
* Create a dynamic box.
* Create a dynamic rigid-bodies.
*/
let rad = 0.4;
let mut build_rigid_body_with_coupling = |x, y, collider: Collider| {
Expand All @@ -109,8 +109,8 @@ pub fn init_world(testbed: &mut Testbed) {
let rb = RigidBodyBuilder::dynamic()
.translation(Vector2::new(x, y))
.build();
let _rb_handle = bodies.insert(rb);
let co_handle = colliders.insert(collider);
let rb_handle = bodies.insert(rb);
let co_handle = colliders.insert_with_parent(collider, rb_handle, &mut bodies);
let bo_handle = fluids_pipeline
.liquid_world
.add_boundary(Boundary::new(Vec::new()));
Expand Down
4 changes: 2 additions & 2 deletions examples2d/elasticity2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,9 @@ pub fn init_world(testbed: &mut Testbed) {
plugin.set_fluid_color(fluid_handle, Point3::new(0.6, 0.8, 0.5));

// Setup the ground.
bodies.insert(RigidBodyBuilder::fixed().build());
let ground_handle = bodies.insert(RigidBodyBuilder::fixed().build());
let co = ColliderBuilder::cuboid(ground_half_width, ground_thickness).build();
let co_handle = colliders.insert(co);
let co_handle = colliders.insert_with_parent(co, ground_handle, &mut bodies);
let bo_handle = fluids_pipeline
.liquid_world
.add_boundary(Boundary::new(Vec::new()));
Expand Down
4 changes: 2 additions & 2 deletions examples2d/surface_tension2.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,9 +45,9 @@ pub fn init_world(testbed: &mut Testbed) {
let ground_thickness = 0.02;
let ground_half_width = 0.15;

bodies.insert(RigidBodyBuilder::fixed().build());
let ground_handle = bodies.insert(RigidBodyBuilder::fixed().build());
let co = ColliderBuilder::cuboid(ground_half_width, ground_thickness).build();
let co_handle = colliders.insert(co);
let co_handle = colliders.insert_with_parent(co, ground_handle, &mut bodies);
let bo_handle = fluids_pipeline
.liquid_world
.add_boundary(Boundary::new(Vec::new()));
Expand Down
4 changes: 2 additions & 2 deletions examples3d/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,8 @@ parallel = [ "rapier_testbed3d/parallel", "salva3d/parallel"]
num-traits = "0.2"
Inflector = "0.11"
nalgebra = "0.32"
rapier3d = "0.17"
rapier_testbed3d = "0.17"
rapier3d = "0.18"
rapier_testbed3d = "0.18"
parry3d = "0.13"
bevy = "0.12.1"

Expand Down
2 changes: 1 addition & 1 deletion examples3d/elasticity3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ pub fn init_world(testbed: &mut Testbed) {
let ground_handle = bodies.insert(RigidBodyBuilder::fixed().build());
let co =
ColliderBuilder::cuboid(ground_half_width, ground_thickness, ground_half_width).build();
let co_handle = colliders.insert(co);
let co_handle = colliders.insert_with_parent(co, ground_handle, &mut bodies);
let bo_handle = fluids_pipeline
.liquid_world
.add_boundary(Boundary::new(Vec::new()));
Expand Down
2 changes: 1 addition & 1 deletion examples3d/faucet3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ pub fn init_world(testbed: &mut Testbed) {
let co = ColliderBuilder::ball(ground_rad).build();
let ball_samples =
salva3d::sampling::shape_surface_ray_sample(co.shape(), PARTICLE_RADIUS).unwrap();
let co_handle = colliders.insert(co);
let co_handle = colliders.insert_with_parent(co, ground_handle, &mut bodies);
let bo_handle = fluids_pipeline
.liquid_world
.add_boundary(Boundary::new(Vec::new()));
Expand Down
2 changes: 1 addition & 1 deletion examples3d/surface_tension3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ pub fn init_world(testbed: &mut Testbed) {

let co =
ColliderBuilder::cuboid(ground_half_width, ground_thickness, ground_half_width).build();
let co_handle = colliders.insert(co);
let co_handle = colliders.insert_with_parent(co, ground_handle, &mut bodies);
let bo_handle = fluids_pipeline
.liquid_world
.add_boundary(Boundary::new(Vec::new()));
Expand Down
4 changes: 2 additions & 2 deletions src/coupling/coupling_manager.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ pub trait CouplingManager {
);

/// Transmit forces from salva's boundary objects to the coupled bodies.
fn transmit_forces(&mut self, boundaries: &BoundarySet);
fn transmit_forces(&mut self, timestep: &TimestepManager, boundaries: &BoundarySet);
}

impl CouplingManager for () {
Expand All @@ -39,5 +39,5 @@ impl CouplingManager for () {
) {
}

fn transmit_forces(&mut self, _: &BoundarySet) {}
fn transmit_forces(&mut self, _: &TimestepManager, _: &BoundarySet) {}
}
4 changes: 2 additions & 2 deletions src/integrations/rapier/fluids_pipeline.rs
Original file line number Diff line number Diff line change
Expand Up @@ -260,7 +260,7 @@ impl<'a> CouplingManager for ColliderCouplingManager<'a> {
}
}

fn transmit_forces(&mut self, boundaries: &BoundarySet) {
fn transmit_forces(&mut self, timestep: &TimestepManager, boundaries: &BoundarySet) {
for (collider, coupling) in &self.coupling.entries {
if let (Some(collider), Some(boundary)) = (
self.colliders.get(*collider),
Expand All @@ -277,7 +277,7 @@ impl<'a> CouplingManager for ColliderCouplingManager<'a> {
for (pos, force) in
boundary.positions.iter().zip(forces.iter().cloned())
{
body.add_force_at_point(force, *pos, true)
body.apply_impulse_at_point(force * timestep.dt(), *pos, true)
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion src/liquid_world.rs
Original file line number Diff line number Diff line change
Expand Up @@ -143,7 +143,7 @@ impl LiquidWorld {
self.boundaries.as_slice(),
);

coupling.transmit_forces(&self.boundaries);
coupling.transmit_forces(&self.timestep_manager, &self.boundaries);
self.counters.stages.solver_time.pause();
}

Expand Down
Loading