Skip to content

Commit

Permalink
Option to lock interaction threshold to particle radius
Browse files Browse the repository at this point in the history
  • Loading branch information
Masterchef365 committed Dec 15, 2023
1 parent 78e2fd9 commit 1b5edfd
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/app.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ pub struct TemplateApp {
width: usize,
height: usize,
calc_rest_density_from_radius: bool,
set_inter_dist_to_radius: bool,
//show_arrows: bool,
//show_grid: bool,
//grid_vel_scale: f32,
Expand Down Expand Up @@ -84,6 +85,7 @@ impl TemplateApp {
//grid_vel_scale: 0.05,
//show_grid: false,
show_settings_only: false,
set_inter_dist_to_radius: false,
//mult: 1.0,
}
}
Expand Down Expand Up @@ -372,12 +374,18 @@ impl TemplateApp {
.speed(1e-2)
.prefix("Default repulse: "),
);
ui.horizontal(|ui| {
ui.add(
DragValue::new(&mut behav_cfg.inter_threshold)
.clamp_range(0.0..=20.0)
.speed(1e-2)
.prefix("Interaction threshold: "),
);
ui.checkbox(&mut self.set_inter_dist_to_radius, "From radius");
});
}
if self.set_inter_dist_to_radius {
behav_cfg.inter_threshold = self.sim.particle_radius;
}
for b in self.sim.life.behaviours.data_mut() {
b.max_inter_dist = behav_cfg.max_inter_dist;
Expand Down

0 comments on commit 1b5edfd

Please sign in to comment.