implement rotation stabilizer (key Y)
This commit is contained in:
parent
9ea79ff80f
commit
d0df5c5dbd
|
@ -41,6 +41,7 @@ Links:
|
||||||
- Tab: Toggle HUD/AR
|
- Tab: Toggle HUD/AR
|
||||||
- F11: Toggle fullscreen
|
- F11: Toggle fullscreen
|
||||||
- F: Toggle 3rd person view
|
- F: Toggle 3rd person view
|
||||||
|
- Y: Toggle rotation stabilizer
|
||||||
- T: Toggle music
|
- T: Toggle music
|
||||||
- M: Toggle sound effects
|
- M: Toggle sound effects
|
||||||
- Cheats
|
- Cheats
|
||||||
|
|
|
@ -117,10 +117,15 @@ pub fn update_fov(
|
||||||
pub fn handle_input(
|
pub fn handle_input(
|
||||||
keyboard_input: Res<ButtonInput<KeyCode>>,
|
keyboard_input: Res<ButtonInput<KeyCode>>,
|
||||||
mut settings: ResMut<settings::Settings>,
|
mut settings: ResMut<settings::Settings>,
|
||||||
|
mut ew_sfx: EventWriter<audio::PlaySfxEvent>,
|
||||||
) {
|
) {
|
||||||
if keyboard_input.just_pressed(settings.key_camera) {
|
if keyboard_input.just_pressed(settings.key_camera) {
|
||||||
settings.third_person ^= true;
|
settings.third_person ^= true;
|
||||||
}
|
}
|
||||||
|
if keyboard_input.just_pressed(settings.key_rotation_stabilizer) {
|
||||||
|
ew_sfx.send(audio::PlaySfxEvent(audio::Sfx::Click));
|
||||||
|
settings.rotation_stabilizer_active ^= true;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fn manage_player_actor(
|
fn manage_player_actor(
|
||||||
|
@ -301,7 +306,11 @@ pub fn apply_input_to_player(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
let angular_slowdown: f64 = (2.0 - engine.reaction_wheels.powf(0.01).clamp(1.001, 1.1)) as f64;
|
let angular_slowdown: f64 = if settings.rotation_stabilizer_active {
|
||||||
|
(2.0 - engine.reaction_wheels.powf(0.01).clamp(1.001, 1.1)) as f64
|
||||||
|
} else {
|
||||||
|
1.0
|
||||||
|
};
|
||||||
if pitch_yaw_rot.length_squared() > 1.0e-18 {
|
if pitch_yaw_rot.length_squared() > 1.0e-18 {
|
||||||
play_reactionwheel_sound = true;
|
play_reactionwheel_sound = true;
|
||||||
pitch_yaw_rot *= settings.mouse_sensitivity * sensitivity_factor * engine.reaction_wheels;
|
pitch_yaw_rot *= settings.mouse_sensitivity * sensitivity_factor * engine.reaction_wheels;
|
||||||
|
|
|
@ -19,6 +19,7 @@ pub struct Settings {
|
||||||
pub hud_active: bool,
|
pub hud_active: bool,
|
||||||
pub is_zooming: bool,
|
pub is_zooming: bool,
|
||||||
pub third_person: bool,
|
pub third_person: bool,
|
||||||
|
pub rotation_stabilizer_active: bool,
|
||||||
pub key_selectobject: MouseButton,
|
pub key_selectobject: MouseButton,
|
||||||
pub key_zoom: MouseButton,
|
pub key_zoom: MouseButton,
|
||||||
pub key_togglehud: KeyCode,
|
pub key_togglehud: KeyCode,
|
||||||
|
@ -37,6 +38,7 @@ pub struct Settings {
|
||||||
pub key_vehicle: KeyCode,
|
pub key_vehicle: KeyCode,
|
||||||
pub key_camera: KeyCode,
|
pub key_camera: KeyCode,
|
||||||
pub key_rotate: KeyCode,
|
pub key_rotate: KeyCode,
|
||||||
|
pub key_rotation_stabilizer: KeyCode,
|
||||||
pub key_mouseup: KeyCode,
|
pub key_mouseup: KeyCode,
|
||||||
pub key_mousedown: KeyCode,
|
pub key_mousedown: KeyCode,
|
||||||
pub key_mouseleft: KeyCode,
|
pub key_mouseleft: KeyCode,
|
||||||
|
@ -101,6 +103,7 @@ impl Default for Settings {
|
||||||
hud_active: false,
|
hud_active: false,
|
||||||
is_zooming: false,
|
is_zooming: false,
|
||||||
third_person: false,
|
third_person: false,
|
||||||
|
rotation_stabilizer_active: true,
|
||||||
key_selectobject: MouseButton::Left,
|
key_selectobject: MouseButton::Left,
|
||||||
key_zoom: MouseButton::Right,
|
key_zoom: MouseButton::Right,
|
||||||
key_togglehud: KeyCode::Tab,
|
key_togglehud: KeyCode::Tab,
|
||||||
|
@ -119,6 +122,7 @@ impl Default for Settings {
|
||||||
key_vehicle: KeyCode::KeyQ,
|
key_vehicle: KeyCode::KeyQ,
|
||||||
key_camera: KeyCode::KeyF,
|
key_camera: KeyCode::KeyF,
|
||||||
key_rotate: KeyCode::KeyR,
|
key_rotate: KeyCode::KeyR,
|
||||||
|
key_rotation_stabilizer: KeyCode::KeyY,
|
||||||
key_mouseup: KeyCode::KeyI,
|
key_mouseup: KeyCode::KeyI,
|
||||||
key_mousedown: KeyCode::KeyK,
|
key_mousedown: KeyCode::KeyK,
|
||||||
key_mouseleft: KeyCode::KeyJ,
|
key_mouseleft: KeyCode::KeyJ,
|
||||||
|
|
Loading…
Reference in a new issue