diff --git a/Cargo.lock b/Cargo.lock index 5a40516..ad75e81 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -208,6 +208,16 @@ dependencies = [ "libloading 0.7.4", ] +[[package]] +name = "astraea" +version = "0.1.0" +dependencies = [ + "bevy", + "rand", + "serde", + "serde_json", +] + [[package]] name = "async-broadcast" version = "0.5.1" @@ -305,16 +315,6 @@ dependencies = [ "bevy_internal", ] -[[package]] -name = "bevy-test" -version = "0.1.0" -dependencies = [ - "bevy", - "rand", - "serde", - "serde_json", -] - [[package]] name = "bevy_a11y" version = "0.14.2" diff --git a/Cargo.toml b/Cargo.toml index 0a26a64..8badc97 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,5 +1,5 @@ [package] -name = "bevy-test" +name = "astraea" version = "0.1.0" edition = "2021" diff --git a/src/game_state.rs b/src/game_state.rs index d317694..bc82407 100644 --- a/src/game_state.rs +++ b/src/game_state.rs @@ -362,9 +362,14 @@ fn choose_constellation( let target_index = rng.next_u32().rem_euclid(4) as usize; let target_constellation = &constellations[target_index]; + + let mut mean_pos = Vec3::ZERO; + for star in target_constellation.stars.clone() { + mean_pos += celestial_to_cartesian(star.rah, star.dec) + } let target_rotation = Quat::from_rotation_arc( Vec3::Z, - -celestial_to_cartesian(target_constellation.rah, target_constellation.dec), + -mean_pos*(1.0/target_constellation.stars.len() as f32), ); player.target_rotation = Some(target_rotation);