constellation center
This commit is contained in:
parent
84f7ed3611
commit
f27f783501
20
Cargo.lock
generated
20
Cargo.lock
generated
|
@ -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"
|
||||
|
|
|
@ -1,5 +1,5 @@
|
|||
[package]
|
||||
name = "bevy-test"
|
||||
name = "astraea"
|
||||
version = "0.1.0"
|
||||
edition = "2021"
|
||||
|
||||
|
|
|
@ -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);
|
||||
|
|
Loading…
Reference in a new issue