Skip to content

fix: restore getTimeScale() in VectorsOperations so physics body moves#325

Merged
mattqdev merged 1 commit into
physicshub:mainfrom
TechGenius-Karan:fix/vectors-operations-physics-frozen
May 22, 2026
Merged

fix: restore getTimeScale() in VectorsOperations so physics body moves#325
mattqdev merged 1 commit into
physicshub:mainfrom
TechGenius-Karan:fix/vectors-operations-physics-frozen

Conversation

@TechGenius-Karan
Copy link
Copy Markdown
Contributor

📘 Pull Request Template – PhysicsHub

Thank you for contributing to PhysicsHub!
Please complete the sections below to help us review your pull request efficiently.


🔍 Description

What was wrong

When physicsEnabled is turned on in the Vector Operations simulation, a physics ball is supposed to appear and move
around the canvas responding to forces. It showed up on screen but was completely frozen — no movement at all.

The cause: a debug leftover on one line:
const scale = 0; //getTimeScale();
The physics accumulator was being multiplied by 0 every frame, so the Planck.js world was never stepped forward, and
the ball never moved.

Fix

Restored the original getTimeScale() call and added it to the imports from Time.js:
const scale = getTimeScale(); // was: const scale = 0;

Closes #BUG-003 (if applicable)


✅ Checklist

Before requesting a review, please ensure that you have:

  • Verified that the project builds and runs locally (npm run dev)
  • Ensured no ESLint or TypeScript warnings/errors remain
  • Updated documentation, comments, or in-code explanations where needed
  • Verified responsiveness across devices (desktop, tablet, mobile)
  • Followed the CONTRIBUTING.md guidelines

🎨 Visual Changes (if UI-related)

IF CHANGES ARE RELATED TO SIMULATIONS PLEASE SEND A SHORT CLIP ABOUT IT
(OBLIGATORY)


📂 Type of Change

  • 🐛 Bug fix (non-breaking change that fixes an issue)
  • ✨ New feature (non-breaking change that adds functionality)
  • 💥 Breaking change (fix or feature that would cause existing functionality to change)
  • 📝 Documentation update
  • ♻️ Refactor / code quality improvement
  • 🎨 UI/UX enhancement
  • 🔒 Security improvement

🧩 Additional Notes for Reviewers

The physics accumulator was multiplied by a hardcoded scale of 0,
so worldRef.current.step() was never called and the Planck.js body
was permanently frozen regardless of the physicsEnabled toggle.

Restored the getTimeScale() call and added it to the Time.js imports.
@mattqdev mattqdev merged commit 6e20963 into physicshub:main May 22, 2026
1 check passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants