diff --git a/examples/context_layering.rs b/examples/context_layering.rs index f523a56..06e0926 100644 --- a/examples/context_layering.rs +++ b/examples/context_layering.rs @@ -108,7 +108,7 @@ impl InputContext for PlayerBox { ctx.bind::() .with_wasd() .with_modifier(Normalize) - .with_modifier(ScaleByDelta) + .with_modifier(SmoothDelta::new(SmoothKind::Linear)) .with_modifier(Scalar::splat(DEFAULT_SPEED)); ctx.bind::().with(KeyCode::Space); ctx.bind::().with(KeyCode::Enter); diff --git a/examples/context_sharing.rs b/examples/context_sharing.rs index 8a6b7ac..4e4e841 100644 --- a/examples/context_sharing.rs +++ b/examples/context_sharing.rs @@ -79,7 +79,7 @@ impl InputContext for PlayerBox { ctx.bind::() .with_wasd() .with_modifier(Normalize) - .with_modifier(ScaleByDelta) + .with_modifier(SmoothDelta::new(SmoothKind::Linear)) .with_modifier(Scalar::splat(DEFAULT_SPEED)); ctx.bind::().with(KeyCode::Space); diff --git a/examples/context_switch.rs b/examples/context_switch.rs index 4ace1ed..bb120ac 100644 --- a/examples/context_switch.rs +++ b/examples/context_switch.rs @@ -103,7 +103,7 @@ impl InputContext for OnFoot { .bind::() .with_wasd() .with_modifier(Normalize) - .with_modifier(ScaleByDelta) + .with_modifier(SmoothDelta::new(SmoothKind::Linear)) .with_modifier(Scalar::splat(DEFAULT_SPEED)); instance.bind::().with(KeyCode::Space); instance.bind::().with(KeyCode::Enter); @@ -134,7 +134,7 @@ impl InputContext for InCar { ctx.bind::() .with_wasd() .with_modifier(Normalize) - .with_modifier(ScaleByDelta) + .with_modifier(SmoothDelta::new(SmoothKind::Linear)) .with_modifier(Scalar::splat(DEFAULT_SPEED + 200.0)); // Make car faster. ctx.bind::().with(KeyCode::Enter); diff --git a/examples/local_multiplayer.rs b/examples/local_multiplayer.rs index 5c2becf..28b435e 100644 --- a/examples/local_multiplayer.rs +++ b/examples/local_multiplayer.rs @@ -116,7 +116,7 @@ impl InputContext for PlayerBox { // In our case we cant to add modifiers for all players. ctx.bind::() .with_modifier(Normalize) - .with_modifier(ScaleByDelta) + .with_modifier(SmoothDelta::new(SmoothKind::Linear)) .with_modifier(Scalar::splat(DEFAULT_SPEED)); ctx diff --git a/examples/player_box/mod.rs b/examples/player_box/mod.rs index 278f617..2f5a5df 100644 --- a/examples/player_box/mod.rs +++ b/examples/player_box/mod.rs @@ -29,7 +29,7 @@ impl PlayerBoxPlugin { } } -pub(super) const DEFAULT_SPEED: f32 = 400.0; +pub(super) const DEFAULT_SPEED: f32 = 10.0; #[derive(Bundle, Default)] pub(super) struct PlayerBoxBundle { diff --git a/examples/simple.rs b/examples/simple.rs index a9a8568..efbcda6 100644 --- a/examples/simple.rs +++ b/examples/simple.rs @@ -75,7 +75,7 @@ impl InputContext for PlayerBox { .with_wasd() .with_stick(GamepadStick::Left) .with_modifier(Normalize) // Normilize to ensure consistent speed, otherwise diagonal movement will be faster. - .with_modifier(ScaleByDelta) // Multiply by delta to make movement independent of framerate. + .with_modifier(SmoothDelta::new(SmoothKind::Linear)) // // Make movement smooth and independent of the framerate. To only make it framerate-independent, use `ScaleByDelta`. .with_modifier(Scalar::splat(DEFAULT_SPEED)); // Additionally multiply by a constant to achieve the desired speed. ctx.bind::() diff --git a/examples/ui_priority.rs b/examples/ui_priority.rs index 2019f75..d9f64da 100644 --- a/examples/ui_priority.rs +++ b/examples/ui_priority.rs @@ -108,7 +108,7 @@ impl InputContext for PlayerBox { ctx.bind::() .with_wasd() .with_modifier(Normalize) - .with_modifier(ScaleByDelta) + .with_modifier(SmoothDelta::new(SmoothKind::Linear)) .with_modifier(Scalar::splat(DEFAULT_SPEED)); ctx.bind::() .with(InputBind::new(Input::mouse_wheel()).with_modifier(SwizzleAxis::YXZ)) diff --git a/src/input_context/input_modifier/smooth_delta.rs b/src/input_context/input_modifier/smooth_delta.rs index 0000195..324850b 100644 --- a/src/input_context/input_modifier/smooth_delta.rs +++ b/src/input_context/input_modifier/smooth_delta.rs @@ -18,6 +18,7 @@ pub struct SmoothDelta { /// Multiplier for delta time, determines the rate of smoothing. /// /// By default set to 8.0, an ad-hoc value that usually produces nice results. + /// See also [`Self::with_speed`]. pub speed: f32, prev_value: Vec3,