Skip to content

Commit

Permalink
chore: update to bevy 0.15.1 and avian3d 0.2.0
Browse files Browse the repository at this point in the history
  • Loading branch information
philiplinden committed Jan 6, 2025
1 parent 16a2c31 commit 1f1c8cb
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 246 deletions.
10 changes: 7 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ members = [
"crates/yahs-ui"
]

default-members = [
"crates/yahs-ui"
]

[workspace.package]
name = "yahs"
description = "Yet Another HAB Simulator"
Expand All @@ -18,11 +22,11 @@ license-file = "LICENSE-APACHE"

[workspace.dependencies]
# Shared dependencies with fixed versions
bevy = { version = "0.15.0", default-features = false, features = [
bevy = { version = "0.15", default-features = false, features = [
"bevy_state", "multi_threaded"
] }
avian3d = { git = "https://github.com/Jondolf/avian.git", branch = "main" }
bevy-trait-query = "0.7.0"
avian3d = "0.2"
bevy-trait-query = "0.7"

# Compile with Performance Optimizations:
# https://bevyengine.org/learn/quick-start/getting-started/setup/#compile-with-performance-optimizations
Expand Down
5 changes: 3 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,16 +35,17 @@ Then you can use all of the components and systems from the
### As an application

Running this package as a standalone application compiles all of the crates
and runs the CLI by default:
and runs the default interface:

```bash
cargo run
```

Force the standalone application to run the GUI instead of the CLI:
You can force the standalone application to run a particular interface too:

```bash
cargo run --bin yahs-ui
cargo run --bin yahs-cli
```

## License
Expand Down
1 change: 0 additions & 1 deletion crates/yahs-cli/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ path = "src/main.rs"
[dependencies]
yahs = { path = "../yahs" }
bevy = { workspace = true, features = [
"bevy_state",
"multi_threaded",
] }
bevy_ratatui = "0.7"
Expand Down
2 changes: 1 addition & 1 deletion crates/yahs-ui/src/scene.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ fn spawn_balloon(
material_properties: BalloonMaterial::default(),
shape: sphere,
},
gas: IdealGas::new(species).with_mass(Mass::new(0.01)),
gas: IdealGas::new(species).with_mass(Mass(0.01)),
},
RigidBody::Dynamic,
Collider::sphere(sphere.radius),
Expand Down
4 changes: 4 additions & 0 deletions crates/yahs/README.md
Original file line number Diff line number Diff line change
@@ -1 +1,5 @@
# yahs

This is the core simulation engine for the Yet Another HAB Simulator.

Uses [avian3d](https://github.com/Jondolf/avian) for physics.
2 changes: 1 addition & 1 deletion crates/yahs/src/forces/body.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ fn update_weight_parameters(
mut bodies: Query<(&mut Weight, &Position, &Mass), With<Balloon>>,
) {
for (mut weight, position, mass) in bodies.iter_mut() {
weight.update(position.0, mass.value());
weight.update(position.0, mass.0);
}
}

Expand Down
232 changes: 0 additions & 232 deletions crates/yahs/src/forces/scratch.rs

This file was deleted.

10 changes: 5 additions & 5 deletions crates/yahs/src/ideal_gas.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ impl Default for IdealGas {
let temperature = Temperature::default();
let pressure = Pressure::default();
let density = ideal_gas_density(temperature, pressure, &species);
let mass = Mass::new(1.0);
let mass = Mass(1.0);
IdealGas {
temperature,
pressure,
Expand All @@ -100,7 +100,7 @@ impl IdealGas {
pub fn new(species: GasSpecies) -> Self {
let temperature = Temperature::default();
let pressure = Pressure::default();
let mass = Mass::new(1.0);
let mass = Mass(1.0);
let density = ideal_gas_density(temperature, pressure, &species);
IdealGas {
temperature,
Expand Down Expand Up @@ -129,12 +129,12 @@ impl IdealGas {
}

pub fn with_volume(mut self, volume: Volume) -> Self {
self.mass = Mass::new(self.density.kg_per_m3() * volume.m3());
self.mass = Mass(self.density.kg_per_m3() * volume.m3());
self
}

pub fn set_volume(&mut self, volume: Volume) {
self.mass = Mass::new(self.density.kg_per_m3() * volume.m3());
self.mass = Mass(self.density.kg_per_m3() * volume.m3());
}

pub fn volume(&self) -> Volume {
Expand All @@ -155,7 +155,7 @@ pub fn ideal_gas_volume(
species: &GasSpecies,
) -> Volume {
Volume(
(mass.value() / species.molar_mass.kilograms_per_mole()) * R * temperature.kelvin()
(mass.0 / species.molar_mass.kilograms_per_mole()) * R * temperature.kelvin()
/ pressure.pascals(),
)
}
Expand Down
2 changes: 1 addition & 1 deletion crates/yahs/src/properties.rs
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ impl Density {
pub const ZERO: Self = Density(0.0);

pub fn new(kilograms: Mass, volume: Volume) -> Self {
Density(kilograms.value() / volume.cubic_meters())
Density(kilograms.0 / volume.cubic_meters())
}

pub fn kilograms_per_cubic_meter(&self) -> f32 {
Expand Down

0 comments on commit 1f1c8cb

Please sign in to comment.