fix tidal locking rotation for galileian moons
This commit is contained in:
parent
d98b216c8d
commit
ec218c6351
26
src/cmd.rs
26
src/cmd.rs
|
@ -839,8 +839,8 @@ fn spawn_entities(
|
|||
} else {
|
||||
state.pos
|
||||
};
|
||||
if let Some(r) = state.orbit_distance {
|
||||
let mass: Option<f64> = if let Some(id) = &state.orbit_object_id {
|
||||
|
||||
let orbited_mass: Option<f64> = if let Some(id) = &state.orbit_object_id {
|
||||
match id.as_str() {
|
||||
"jupiter" => Some(nature::JUPITER_MASS),
|
||||
"sol" => Some(nature::JUPITER_MASS),
|
||||
|
@ -852,16 +852,10 @@ fn spawn_entities(
|
|||
} else {
|
||||
None
|
||||
};
|
||||
absolute_pos += nature::pos_offset_for_orbiting_body(r, mass, state.orbit_phase);
|
||||
|
||||
if state.is_tidally_locked {
|
||||
if let Some(mass) = mass {
|
||||
rotation =
|
||||
Quat::from_rotation_y(nature::rotation_for_orbiting_body(r, mass) as f32);
|
||||
} else {
|
||||
error!("Attempted to use 'tidally locked' without specifying mass via 'orbitaround'");
|
||||
}
|
||||
}
|
||||
if let Some(r) = state.orbit_distance {
|
||||
absolute_pos +=
|
||||
nature::pos_offset_for_orbiting_body(r, orbited_mass, state.orbit_phase);
|
||||
} else if state.is_tidally_locked {
|
||||
error!("Attempted to use 'tidally locked' without specifying orbital distance via 'orbitaround'");
|
||||
}
|
||||
|
@ -931,6 +925,16 @@ fn spawn_entities(
|
|||
});
|
||||
load_asset(model.as_str(), &mut actor, &*asset_server);
|
||||
}
|
||||
if state.is_tidally_locked {
|
||||
if let (Some(r), Some(mass)) = (state.orbit_distance, orbited_mass) {
|
||||
rotation = Quat::from_rotation_y(nature::rotation_for_orbiting_body(r, mass) as f32)
|
||||
* rotation;
|
||||
} else {
|
||||
error!(
|
||||
"Attempted to use 'tidally locked' without specifying mass via 'orbitaround'"
|
||||
);
|
||||
}
|
||||
}
|
||||
actor.insert(Rotation::from(rotation));
|
||||
|
||||
// Physics Parameters
|
||||
|
|
|
@ -85,9 +85,10 @@ actor 0 0 0
|
|||
relativeto jupiter
|
||||
id metis
|
||||
orbitaround jupiter 128000e3
|
||||
tidally locked
|
||||
scale 21.5e3
|
||||
moon yes
|
||||
angularmomentum 0 0.025 0
|
||||
angularmomentum 0 0 0
|
||||
actor 0 0 0 orbitring
|
||||
relativeto jupiter
|
||||
scale 128000e3
|
||||
|
@ -99,9 +100,10 @@ actor 0 0 0
|
|||
relativeto jupiter
|
||||
id adrastea
|
||||
orbitaround jupiter 129000e3
|
||||
tidally locked
|
||||
scale 8.2e3
|
||||
moon yes
|
||||
angularmomentum 0 0.025 0
|
||||
angularmomentum 0 0 0
|
||||
actor 0 0 0 orbitring
|
||||
relativeto jupiter
|
||||
scale 129000e3
|
||||
|
@ -113,9 +115,10 @@ actor 0 0 0
|
|||
relativeto jupiter
|
||||
id amalthea
|
||||
orbitaround jupiter 181365.84e3
|
||||
tidally locked
|
||||
scale 83.5e3
|
||||
moon yes
|
||||
angularmomentum 0 0.025 0
|
||||
angularmomentum 0 0 0
|
||||
actor 0 0 0 orbitring
|
||||
relativeto jupiter
|
||||
scale 181365.84e3
|
||||
|
@ -143,8 +146,9 @@ actor 0 0 0
|
|||
id io
|
||||
relativeto jupiter
|
||||
orbitaround jupiter 421700e3
|
||||
tidally locked
|
||||
scale 1822e3
|
||||
angularmomentum 0 0.0001 0
|
||||
angularmomentum 0 0 0
|
||||
sphere yes
|
||||
moon yes
|
||||
physics off
|
||||
|
@ -159,8 +163,9 @@ actor 0 0 0
|
|||
id europa
|
||||
relativeto jupiter
|
||||
orbitaround jupiter 670900e3
|
||||
tidally locked
|
||||
scale 1561e3
|
||||
angularmomentum 0 0.0001 0
|
||||
angularmomentum 0 0 0
|
||||
sphere yes
|
||||
moon yes
|
||||
physics off
|
||||
|
@ -175,8 +180,9 @@ actor 0 0 0
|
|||
id ganymede
|
||||
relativeto jupiter
|
||||
orbitaround jupiter 1070400e3
|
||||
tidally locked
|
||||
scale 2634e3
|
||||
angularmomentum 0 0.0001 0
|
||||
angularmomentum 0 0 0
|
||||
sphere yes
|
||||
moon yes
|
||||
physics off
|
||||
|
@ -191,8 +197,9 @@ actor 0 0 0
|
|||
id callisto
|
||||
relativeto jupiter
|
||||
orbitaround jupiter 1882700e3
|
||||
tidally locked
|
||||
scale 2410e3
|
||||
angularmomentum 0 0.0001 0
|
||||
angularmomentum 0 0 0
|
||||
sphere yes
|
||||
moon yes
|
||||
physics off
|
||||
|
|
Loading…
Reference in a new issue