"space" key now slows down relative to orbital velocity

This commit is contained in:
yuni 2024-06-11 01:04:23 +02:00
parent 77c1bd1e6a
commit d04b400fad

View file

@ -416,6 +416,7 @@ pub fn apply_input_to_player(
time: Res<Time>,
mut commands: Commands,
settings: Res<var::Settings>,
jupiter_pos: Res<game::JupiterPos>,
windows: Query<&Window, With<PrimaryWindow>>,
mut mouse_events: EventReader<MouseMotion>,
key_input: Res<ButtonInput<KeyCode>>,
@ -426,6 +427,7 @@ pub fn apply_input_to_player(
Entity,
&Transform,
&mut actor::Engine,
&Position,
&mut LinearVelocity,
&mut ExternalTorque,
Option<&actor::PlayerDrivesThis>,
@ -451,15 +453,15 @@ pub fn apply_input_to_player(
win_res_y = 1050.0;
}
if let Ok((player_entity, player_transform, mut engine, pos, mut v, mut torque, bike)) =
q_playercam.get_single_mut()
{
let target_v: DVec3 = if let Ok(target) = q_target.get_single() {
target.0
} else {
DVec3::splat(0.0)
let relative_pos = pos.0 - jupiter_pos.0;
nature::orbital_velocity(relative_pos, nature::JUPITER_MASS)
};
if let Ok((player_entity, player_transform, mut engine, mut v, mut torque, bike)) =
q_playercam.get_single_mut()
{
// Handle key input
if focused {
if key_input.pressed(settings.key_forward) || settings.cruise_control_active {