Skip to content

Commit

Permalink
scale particles by mass
Browse files Browse the repository at this point in the history
  • Loading branch information
robkau committed Oct 9, 2022
1 parent fb58737 commit 5354dc5
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 4 deletions.
5 changes: 2 additions & 3 deletions src/components.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@ pub(super) struct Mass(pub(super) f32);
pub(super) struct AffineMomentum(pub(super) Mat2);

// fluid constitutive model properties
// todo these fields and this struct doesnt need to be public?
#[derive(Clone, Copy, Component)]
pub(super) struct NewtonianFluidModel {
pub(super) rest_density: f32,
Expand All @@ -47,7 +46,7 @@ impl ConstitutiveModel for NewtonianFluidModel {
commands
.spawn_bundle(SpriteBundle {
texture: asset_server.load("liquid_particle.png"),
transform: Transform::from_scale(Vec3::splat(0.002)), // todo scale me from mass.
transform: Transform::from_scale(Vec3::splat(0.002 * mass)),
..Default::default()
})
.insert_bundle((
Expand Down Expand Up @@ -87,7 +86,7 @@ impl ConstitutiveModel for NeoHookeanHyperElasticModel {
commands
.spawn_bundle(SpriteBundle {
texture: asset_server.load("solid_particle.png"),
transform: Transform::from_scale(Vec3::splat(0.005)), // todo scale me from mass.
transform: Transform::from_scale(Vec3::splat(0.005 * mass)),
..Default::default()
})
.insert_bundle((
Expand Down
2 changes: 1 addition & 1 deletion src/spawners.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ pub(super) fn create_initial_spawners(mut commands: Commands, grid: Res<Grid>) {
particle_velocity: Vec2::new(100.3, -1.3),
particle_velocity_random_vec_a: Vec2::new(-0.0, -0.0),
particle_velocity_random_vec_b: Vec2::new(0.0, 0.0),
particle_mass: 2.,
particle_mass: 1.,
},
steel_properties(),
ParticleSpawnerTag,
Expand Down

0 comments on commit 5354dc5

Please sign in to comment.