Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Bug Description
I took a look at the Body.update function and noticed that the time-corrected Verlet integration equation isn’t implemented correctly. Based on this Stack Overflow post, the acceleration needs to be multiplied by a time-corrected version of deltaTimeSquared.
Proposed Fix
This fix adjusts the Verlet integration calculation in Body.update by applying the correct time correction to the acceleration term. With this change, movement should be more accurate when deltaTime varies. All existing tests pass after this update.
Additional Notes
I’m not completely versed in the math behind the angular velocity calculations, so I haven’t applied a similar fix there. It might need a similar treatment, but I decided to leave that out for now until there’s more clarity on how to address it correctly.