Fix Circular Motion: derive velocity from centripetal force instead of forcing constant speed#360
Open
Siddhant52 wants to merge 1 commit into
Open
Conversation
…f forcing constant speed
|
@Siddhant52 is attempting to deploy a commit to the PhysicsHub's projects Team on Vercel. A member of the Team first needs to authorize it. |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Closes part of #40
Problem: In CircularMotion.jsx, the centripetal force was correctly calculated (F = ma) and applied via applyForce(), but the velocity was then immediately overridden every frame with setMag(speed). This meant the force calculation had no real effect on the motion — it was purely decorative for the visual arrow, and the circular path came from the artificial override, not actual physics.
Fix: Replaced the hard override with a gentle correction (5% per frame) that lets the applied centripetal force genuinely drive the velocity's rotation, while still correcting for small numerical drift so the orbit doesn't spiral over many frames.
Testing: Ran the simulation for 15-20+ seconds — orbit stays stable with no visible spiral-in or spiral-out. Confirmed the path remains a clean circle.