Mouse sensitivity is now affected by delta time

This commit is contained in:
griffi-gh 2023-01-27 22:27:48 +01:00
parent 4c2a29e0a3
commit d9ab57ba12
2 changed files with 4 additions and 3 deletions

View file

@ -19,9 +19,10 @@ fn update_look(
controllers: View<FlyController>,
mut transforms: ViewMut<Transform>,
inputs: UniqueView<Inputs>,
settings: UniqueView<GameSettings>
settings: UniqueView<GameSettings>,
dt: UniqueView<DeltaTime>,
) {
let look = inputs.look * settings.mouse_sensitivity;
let look = inputs.look * settings.mouse_sensitivity * dt.0.as_secs_f32();
if look == Vec2::ZERO { return }
for (_, mut transform) in (&controllers, &mut transforms).iter() {
let (scale, mut rotation, translation) = transform.0.to_scale_rotation_translation();

View file

@ -10,7 +10,7 @@ impl Default for GameSettings {
fn default() -> Self {
Self {
render_distance: 5,
mouse_sensitivity: 0.01,
mouse_sensitivity: 1.,
}
}
}