speedometer shows speed relative to orbital velocity
This commit is contained in:
parent
d04b400fad
commit
46a030f15e
|
@ -707,7 +707,8 @@ fn update_dashboard(
|
||||||
fn update_speedometer(
|
fn update_speedometer(
|
||||||
timer: ResMut<FPSUpdateTimer>,
|
timer: ResMut<FPSUpdateTimer>,
|
||||||
settings: Res<Settings>,
|
settings: Res<Settings>,
|
||||||
q_camera: Query<&LinearVelocity, With<actor::PlayerCamera>>,
|
jupiter_pos: Res<game::JupiterPos>,
|
||||||
|
q_camera: Query<(&LinearVelocity, &Position), With<actor::PlayerCamera>>,
|
||||||
q_player: Query<&actor::ExperiencesGForce, With<actor::Player>>,
|
q_player: Query<&actor::ExperiencesGForce, With<actor::Player>>,
|
||||||
q_target: Query<&LinearVelocity, With<IsTargeted>>,
|
q_target: Query<&LinearVelocity, With<IsTargeted>>,
|
||||||
mut q_speedometer: Query<&mut Style, (With<Speedometer>, Without<Speedometer2>)>,
|
mut q_speedometer: Query<&mut Style, (With<Speedometer>, Without<Speedometer2>)>,
|
||||||
|
@ -717,8 +718,9 @@ fn update_speedometer(
|
||||||
if !settings.hud_active || !timer.0.just_finished() {
|
if !settings.hud_active || !timer.0.just_finished() {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
if let Ok(cam_v) = q_camera.get_single() {
|
if let Ok((cam_v, pos)) = q_camera.get_single() {
|
||||||
let speed = cam_v.length();
|
let orbital_v = nature::orbital_velocity(pos.0 - jupiter_pos.0, nature::JUPITER_MASS);
|
||||||
|
let speed = (cam_v.0 - orbital_v).length();
|
||||||
|
|
||||||
let speedometer_split = 5_000.0;
|
let speedometer_split = 5_000.0;
|
||||||
if let Ok(mut speedometer) = q_speedometer.get_single_mut() {
|
if let Ok(mut speedometer) = q_speedometer.get_single_mut() {
|
||||||
|
|
Loading…
Reference in a new issue