Skip to content

Fix Circular Motion: derive velocity from centripetal force instead of forcing constant speed#360

Merged
mattqdev merged 1 commit into
physicshub:mainfrom
Siddhant52:fix-circular-motion-physics
Jun 23, 2026
Merged

Fix Circular Motion: derive velocity from centripetal force instead of forcing constant speed#360
mattqdev merged 1 commit into
physicshub:mainfrom
Siddhant52:fix-circular-motion-physics

Conversation

@Siddhant52

Copy link
Copy Markdown
Contributor

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.

@vercel

vercel Bot commented Jun 20, 2026

Copy link
Copy Markdown

@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.

@mattqdev mattqdev merged commit 6867cb9 into physicshub:main Jun 23, 2026
1 of 2 checks passed
@mattqdev

Copy link
Copy Markdown
Collaborator

Thank you for this physical fix!

@physicshub

Copy link
Copy Markdown
Owner

🎉 This PR is included in version 3.29.0 🎉

The release is available on GitHub release

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants