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 {
|
} else {
|
||||||
state.pos
|
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() {
|
match id.as_str() {
|
||||||
"jupiter" => Some(nature::JUPITER_MASS),
|
"jupiter" => Some(nature::JUPITER_MASS),
|
||||||
"sol" => Some(nature::JUPITER_MASS),
|
"sol" => Some(nature::JUPITER_MASS),
|
||||||
|
@ -852,16 +852,10 @@ fn spawn_entities(
|
||||||
} else {
|
} else {
|
||||||
None
|
None
|
||||||
};
|
};
|
||||||
absolute_pos += nature::pos_offset_for_orbiting_body(r, mass, state.orbit_phase);
|
|
||||||
|
|
||||||
if state.is_tidally_locked {
|
if let Some(r) = state.orbit_distance {
|
||||||
if let Some(mass) = mass {
|
absolute_pos +=
|
||||||
rotation =
|
nature::pos_offset_for_orbiting_body(r, orbited_mass, state.orbit_phase);
|
||||||
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'");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
} else if state.is_tidally_locked {
|
} else if state.is_tidally_locked {
|
||||||
error!("Attempted to use 'tidally locked' without specifying orbital distance via 'orbitaround'");
|
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);
|
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));
|
actor.insert(Rotation::from(rotation));
|
||||||
|
|
||||||
// Physics Parameters
|
// Physics Parameters
|
||||||
|
|
|
@ -85,9 +85,10 @@ actor 0 0 0
|
||||||
relativeto jupiter
|
relativeto jupiter
|
||||||
id metis
|
id metis
|
||||||
orbitaround jupiter 128000e3
|
orbitaround jupiter 128000e3
|
||||||
|
tidally locked
|
||||||
scale 21.5e3
|
scale 21.5e3
|
||||||
moon yes
|
moon yes
|
||||||
angularmomentum 0 0.025 0
|
angularmomentum 0 0 0
|
||||||
actor 0 0 0 orbitring
|
actor 0 0 0 orbitring
|
||||||
relativeto jupiter
|
relativeto jupiter
|
||||||
scale 128000e3
|
scale 128000e3
|
||||||
|
@ -99,9 +100,10 @@ actor 0 0 0
|
||||||
relativeto jupiter
|
relativeto jupiter
|
||||||
id adrastea
|
id adrastea
|
||||||
orbitaround jupiter 129000e3
|
orbitaround jupiter 129000e3
|
||||||
|
tidally locked
|
||||||
scale 8.2e3
|
scale 8.2e3
|
||||||
moon yes
|
moon yes
|
||||||
angularmomentum 0 0.025 0
|
angularmomentum 0 0 0
|
||||||
actor 0 0 0 orbitring
|
actor 0 0 0 orbitring
|
||||||
relativeto jupiter
|
relativeto jupiter
|
||||||
scale 129000e3
|
scale 129000e3
|
||||||
|
@ -113,9 +115,10 @@ actor 0 0 0
|
||||||
relativeto jupiter
|
relativeto jupiter
|
||||||
id amalthea
|
id amalthea
|
||||||
orbitaround jupiter 181365.84e3
|
orbitaround jupiter 181365.84e3
|
||||||
|
tidally locked
|
||||||
scale 83.5e3
|
scale 83.5e3
|
||||||
moon yes
|
moon yes
|
||||||
angularmomentum 0 0.025 0
|
angularmomentum 0 0 0
|
||||||
actor 0 0 0 orbitring
|
actor 0 0 0 orbitring
|
||||||
relativeto jupiter
|
relativeto jupiter
|
||||||
scale 181365.84e3
|
scale 181365.84e3
|
||||||
|
@ -143,8 +146,9 @@ actor 0 0 0
|
||||||
id io
|
id io
|
||||||
relativeto jupiter
|
relativeto jupiter
|
||||||
orbitaround jupiter 421700e3
|
orbitaround jupiter 421700e3
|
||||||
|
tidally locked
|
||||||
scale 1822e3
|
scale 1822e3
|
||||||
angularmomentum 0 0.0001 0
|
angularmomentum 0 0 0
|
||||||
sphere yes
|
sphere yes
|
||||||
moon yes
|
moon yes
|
||||||
physics off
|
physics off
|
||||||
|
@ -159,8 +163,9 @@ actor 0 0 0
|
||||||
id europa
|
id europa
|
||||||
relativeto jupiter
|
relativeto jupiter
|
||||||
orbitaround jupiter 670900e3
|
orbitaround jupiter 670900e3
|
||||||
|
tidally locked
|
||||||
scale 1561e3
|
scale 1561e3
|
||||||
angularmomentum 0 0.0001 0
|
angularmomentum 0 0 0
|
||||||
sphere yes
|
sphere yes
|
||||||
moon yes
|
moon yes
|
||||||
physics off
|
physics off
|
||||||
|
@ -175,8 +180,9 @@ actor 0 0 0
|
||||||
id ganymede
|
id ganymede
|
||||||
relativeto jupiter
|
relativeto jupiter
|
||||||
orbitaround jupiter 1070400e3
|
orbitaround jupiter 1070400e3
|
||||||
|
tidally locked
|
||||||
scale 2634e3
|
scale 2634e3
|
||||||
angularmomentum 0 0.0001 0
|
angularmomentum 0 0 0
|
||||||
sphere yes
|
sphere yes
|
||||||
moon yes
|
moon yes
|
||||||
physics off
|
physics off
|
||||||
|
@ -191,8 +197,9 @@ actor 0 0 0
|
||||||
id callisto
|
id callisto
|
||||||
relativeto jupiter
|
relativeto jupiter
|
||||||
orbitaround jupiter 1882700e3
|
orbitaround jupiter 1882700e3
|
||||||
|
tidally locked
|
||||||
scale 2410e3
|
scale 2410e3
|
||||||
angularmomentum 0 0.0001 0
|
angularmomentum 0 0 0
|
||||||
sphere yes
|
sphere yes
|
||||||
moon yes
|
moon yes
|
||||||
physics off
|
physics off
|
||||||
|
|
Loading…
Reference in a new issue