"space" key now slows down relative to orbital velocity
This commit is contained in:
parent
77c1bd1e6a
commit
d04b400fad
|
@ -416,6 +416,7 @@ pub fn apply_input_to_player(
|
||||||
time: Res<Time>,
|
time: Res<Time>,
|
||||||
mut commands: Commands,
|
mut commands: Commands,
|
||||||
settings: Res<var::Settings>,
|
settings: Res<var::Settings>,
|
||||||
|
jupiter_pos: Res<game::JupiterPos>,
|
||||||
windows: Query<&Window, With<PrimaryWindow>>,
|
windows: Query<&Window, With<PrimaryWindow>>,
|
||||||
mut mouse_events: EventReader<MouseMotion>,
|
mut mouse_events: EventReader<MouseMotion>,
|
||||||
key_input: Res<ButtonInput<KeyCode>>,
|
key_input: Res<ButtonInput<KeyCode>>,
|
||||||
|
@ -426,6 +427,7 @@ pub fn apply_input_to_player(
|
||||||
Entity,
|
Entity,
|
||||||
&Transform,
|
&Transform,
|
||||||
&mut actor::Engine,
|
&mut actor::Engine,
|
||||||
|
&Position,
|
||||||
&mut LinearVelocity,
|
&mut LinearVelocity,
|
||||||
&mut ExternalTorque,
|
&mut ExternalTorque,
|
||||||
Option<&actor::PlayerDrivesThis>,
|
Option<&actor::PlayerDrivesThis>,
|
||||||
|
@ -451,15 +453,15 @@ pub fn apply_input_to_player(
|
||||||
win_res_y = 1050.0;
|
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() {
|
let target_v: DVec3 = if let Ok(target) = q_target.get_single() {
|
||||||
target.0
|
target.0
|
||||||
} else {
|
} 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
|
// Handle key input
|
||||||
if focused {
|
if focused {
|
||||||
if key_input.pressed(settings.key_forward) || settings.cruise_control_active {
|
if key_input.pressed(settings.key_forward) || settings.cruise_control_active {
|
||||||
|
|
Loading…
Reference in a new issue