-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
[Merged by Bors] - Change breakout to use fixed timestamp #1541
Conversation
need a rebase to fix CI |
f442a65
to
eaaef00
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is a clean change, and fixing strange behavior and obvious bugs in our example games is worth the added complexity.
71fff34
to
aa1542a
Compare
Changed the speeds to 8.0 and 6.0 as these were whole numbers close to the original speed and from my eye test it seems like whole numbers animate a little smoother. I should mention that this PR doesn't fix everything from #1240 as there are still some wonky collision detection between the ball and the paddle. |
aa1542a
to
a46f6d6
Compare
examples/game/breakout.rs
Outdated
@@ -63,7 +72,7 @@ fn setup( | |||
..Default::default() | |||
}) | |||
.with(Ball { | |||
velocity: 400.0 * Vec3::new(0.5, -0.5, 0.0).normalize(), | |||
velocity: 6.0 * Vec3::new(0.5, -0.5, 0.0).normalize(), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is still "not velocity" with the new implementation. You effectively pre-multiplied TIME_STEP and velocity. This has the effect of changing object speed if someone changes the timestep value here: https://github.com/bevyengine/bevy/pull/1541/files#diff-4dcbfd17ebad2621b5605be8bd3b43859376e27f30793a937858d470627ed2b2R18
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
movement speed should be timestep independent
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops. I shouldn't read comments right before I fall asleep. Should be fixed now.
a46f6d6
to
c02bf1c
Compare
c02bf1c
to
19a1863
Compare
Just adapted this to use the newly-added SystemSet. This slightly reduces boilerplate. |
bors r+ |
This PR fixes #1240, where the ball is escaping the playing field at low framerates. I did this by moving the movement and physics system into a Fixed Timestep system set and changing the movement steps to a constant. So we lose the example use of delta_time for changing position, but gain a use of FixedTimestep. If this is accepted bevyengine/bevy-website#102 will need to be updated to match. Co-authored-by: Carter Anderson <mcanders1@gmail.com>
Pull request successfully merged into main. Build succeeded: |
This PR fixes bevyengine#1240, where the ball is escaping the playing field at low framerates. I did this by moving the movement and physics system into a Fixed Timestep system set and changing the movement steps to a constant. So we lose the example use of delta_time for changing position, but gain a use of FixedTimestep. If this is accepted bevyengine/bevy-website#102 will need to be updated to match. Co-authored-by: Carter Anderson <mcanders1@gmail.com>
This PR fixes bevyengine#1240, where the ball is escaping the playing field at low framerates. I did this by moving the movement and physics system into a Fixed Timestep system set and changing the movement steps to a constant. So we lose the example use of delta_time for changing position, but gain a use of FixedTimestep. If this is accepted bevyengine/bevy-website#102 will need to be updated to match. Co-authored-by: Carter Anderson <mcanders1@gmail.com>
This PR fixes #1240, where the ball is escaping the playing field at low framerates. I did this by moving the movement and physics system into a Fixed Timestep system set and changing the movement steps to a constant. So we lose the example use of delta_time for changing position, but gain a use of FixedTimestep.
If this is accepted bevyengine/bevy-website#102 will need to be updated to match.