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
Fix weather particle physics. #19596
Conversation
The trait documentation specified that the speed and offset values are px/tick, but they have actually always been treated as px/render. Fix the update logic and rescale the map definitions to account for the fixed behaviour.
// SwingSpeed is defined in px/tick so we must account for the fraction of a tick that elapsed since the last render. | ||
// The scale is capped at 1 tick to avoid unexpected behaviour at game start, if RunTime overflows, or if the game stalls. | ||
var runtime = Game.RunTime; | ||
var tickFraction = Math.Min((runtime - lastRender) * 1f / world.Timestep, 1); |
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.
tickFraction
looks like something we might want to eventually calculate and expose at a central, publicly accessible place like Game
, so we can reuse it for things like interpolation and don't need to do the math locally in every place that needs it.
Just thinking aloud, not a request for this particular PR.
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.
You are thinking of something like https://love2d.org/wiki/dt delta time?
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.
Fix confirmed and LGTM
Hey everybody, thanks for the fix! |
Fixes #18025. See commit message for description.