Wire up particle-system debris effects in fatigue simulators#81
Conversation
|
@copilot Is it complete? Does everything works as designed? Is it ready to merge to prod? |
Co-authored-by: overdeckat <263444311+overdeckat@users.noreply.github.com>
Yes — the specific bug fixed by this PR is complete and working: What was broken: What the PR fixes:
Verification (all pass):
The PR is ready to merge to production for this specific fix (commit |
There was a problem hiding this comment.
Pull request overview
This PR wires up the shared ParticleSystem debris effects into the two fatigue simulators so the existing “debris” UI toggle actually produces a visible failure effect, consistent with the other mechanical simulations.
Changes:
- Load
src/js/particle-system.jsonfatica-flessione.htmlandfatica-termica.html. - Add/init/update/emit/reset integration points for a mesh-debris particle system in both fatigue simulators.
- Add missing
debrisSystemstate slot toThermalFatigueSimulator.
Reviewed changes
Copilot reviewed 4 out of 4 changed files in this pull request and generated 1 comment.
| File | Description |
|---|---|
src/js/sim-thermal-fatigue.js |
Adds debrisSystem state and integrates init/update/emit/reset for debris particles. |
src/js/sim-fatigue-bending.js |
Integrates init/update/emit/reset for debris particles (but currently introduces a syntax-breaking issue in addCrack). |
fatica-termica.html |
Loads particle-system.js before the thermal fatigue simulator script. |
fatica-flessione.html |
Loads particle-system.js before the fatigue bending simulator script. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| }, | ||
|
|
||
| /** | ||
| * Add a visible crack to the specimen |
There was a problem hiding this comment.
addCrack(severity) lost its function declaration here (the body starts immediately with if (!this.showCracks) return;). This makes the object literal invalid JS and will break the whole simulator script. Restore the addCrack(severity) { line before the body and ensure the JSDoc block is properly closed.
| * Add a visible crack to the specimen | |
| * Add a visible crack to the specimen | |
| */ | |
| addCrack(severity) { |
Both fatigue simulators (
fatica-flessione,fatica-termica) exposed debris toggle UI and held adebrisSystem: nullstate slot, butparticle-system.jswas never loaded andParticleSystemwas never called — so the checkbox did nothing and no debris appeared on failure.Changes
fatica-flessione.html,fatica-termica.html): addparticle-system.jsscript tag before the sim scriptThermalFatigueSimulator: declaredebrisSystem: nullalongside the existingshowDebrisflag (was missing entirely)initParticleSystems()— called frominit()afterinitCracks(); creates aMeshDebrissystem coloured from the current material; no-ops with aconsole.warnif the module isn't presentupdateParticleSystems(deltaTime)— called every frame inanimate()to advance debris physicstriggerFailure()— callsdebrisSystem.emit()whenshowDebrisis trueresetSimulation()— deactivates and hides the debris group so particles don't bleed across resetsOriginal prompt
🔒 GitHub Advanced Security automatically protects Copilot coding agent pull requests. You can protect all pull requests by enabling Advanced Security for your repositories. Learn more about Advanced Security.