Clamp the timestep to stop ball from escaping
This commit is contained in:
parent
11748456b6
commit
e980b83ce2
@ -190,8 +190,11 @@ fn paddle_movement_system(
|
||||
}
|
||||
|
||||
fn ball_movement_system(time: Res<Time>, mut ball_query: Query<(&Ball, &mut Translation)>) {
|
||||
// clamp the timestep to stop the ball from escaping when the game starts
|
||||
let delta_seconds = f32::min(0.2, time.delta_seconds);
|
||||
|
||||
for (ball, mut translation) in &mut ball_query.iter() {
|
||||
translation.0 += ball.velocity * time.delta_seconds;
|
||||
translation.0 += ball.velocity * delta_seconds;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Loading…
Reference in New Issue
Block a user