{"id":32891036,"url":"https://github.com/pietras333/spring-mass-systems","last_synced_at":"2025-11-10T03:03:01.295Z","repository":{"id":322661948,"uuid":"1090401993","full_name":"pietras333/spring-mass-systems","owner":"pietras333","description":"A real-time spring–mass simulation built in Unity, visualized with 3D meshes and a coil-shaped LineRenderer. It demonstrates principles of classical mechanics, Hooke’s Law, damping, and numerical motion integration. ","archived":false,"fork":false,"pushed_at":"2025-11-05T16:39:44.000Z","size":80,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-11-05T18:24:41.888Z","etag":null,"topics":["hookes-law","numerical-integration","physics-simulation","spring-mass","unity3d"],"latest_commit_sha":null,"homepage":"","language":"Mathematica","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/pietras333.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2025-11-05T16:08:56.000Z","updated_at":"2025-11-05T16:40:12.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/pietras333/spring-mass-systems","commit_stats":null,"previous_names":["pietras333/spring-mass-systems"],"tags_count":1,"template":false,"template_full_name":null,"purl":"pkg:github/pietras333/spring-mass-systems","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pietras333%2Fspring-mass-systems","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pietras333%2Fspring-mass-systems/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pietras333%2Fspring-mass-systems/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pietras333%2Fspring-mass-systems/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/pietras333","download_url":"https://codeload.github.com/pietras333/spring-mass-systems/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/pietras333%2Fspring-mass-systems/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":283614275,"owners_count":26864945,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-11-10T02:00:06.292Z","response_time":53,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["hookes-law","numerical-integration","physics-simulation","spring-mass","unity3d"],"created_at":"2025-11-10T03:01:07.494Z","updated_at":"2025-11-10T03:03:01.290Z","avatar_url":"https://github.com/pietras333.png","language":"Mathematica","funding_links":[],"categories":[],"sub_categories":[],"readme":"# 🧮 Spring–Mass Simulator (Unity 3D)\n\nA real-time spring–mass simulation built in Unity, visualized with 3D meshes and a coil-shaped LineRenderer.  \nIt demonstrates principles of classical mechanics, Hooke’s Law, damping, and numerical motion integration.\n\u003cimg width=\"1919\" height=\"883\" alt=\"spring-mass\" src=\"https://github.com/user-attachments/assets/913e4b61-9d9f-4532-b1cf-b72feba53ecf\" /\u003e\n\n---\n\nhttps://github.com/user-attachments/assets/03aae041-4805-4fd0-ac11-f0796b75b529\n\n\n\n## ⚙️ Overview\n\nThis project simulates a single or multiple spring–mass systems influenced by:\n\n- Newton’s Second Law of Motion  \n- Hooke’s Law of Elasticity  \n- Damping Force  \n- Gravitational Force  \n\nEach mass point changes color based on its velocity using a gradient, visualizing kinetic energy in real time.\n\n---\n\n## 🧠 Core Physics Concepts\n\nThe simulation models these relationships:\n\n- Spring Force (Hooke’s Law)  \n- Damping Force proportional to velocity  \n- Gravitational Force acting downward  \n- Net Force = sum of spring, damping, and gravity  \n- Acceleration = Force / Mass  \n- Velocity and position updated using Euler integration  \n\nThe motion approximates a damped harmonic oscillator.\n\n---\n\n## 🧩 Numerical Integration\n\nUses the semi-explicit Euler method:\n\n1. Compute total force and acceleration.  \n2. Update velocity using acceleration and time step.  \n3. Update position using new velocity.\n\nThis simple integrator is efficient and stable for small time steps.\n\n---\n\n## 🧵 Coil Visualization\n\nThe spring is drawn as a 3D helix between the anchor and mass point.  \nIts shape is generated procedurally using sine and cosine waves around the main spring axis.  \nAdjustable parameters include number of turns, radius, and points per turn.\n\n---\n\n## 🎨 Visual Elements\n\n| Element | Description |\n|----------|-------------|\n| Anchor | Fixed point of the spring |\n| Mass Point | Simulated particle affected by forces |\n| Coil | LineRenderer generated helix between anchor and mass |\n| Gradient | Mass color changes with velocity magnitude |\n\n---\n\n## 📘 References\n\n- Effective Mass in Spring–Mass Systems (Wikipedia)  \n  https://en.wikipedia.org/wiki/Effective_mass_(spring%E2%80%93mass_system)  \n- Motion of a Spring–Mass System – LibreTexts Physics  \n  https://phys.libretexts.org/Courses/Berea_College/Introductory_Physics%3A_Berea_College/13%3A_Simple_Harmonic_Motion/13.01%3A_The_motion_of_a_spring-mass_system  \n\n---\n\n## 🧰 Implementation\n\nCore C# scripts:\n- SpringMassSimulator.cs — Main update loop and visualization  \n- SpringMassSystem.cs — Physics logic (forces, integration)  \n- MassPoint.cs — State container for position, velocity, and mass  \n\nVisualization uses:\n- Mesh prefabs for anchor and mass  \n- LineRenderer for dynamic coil rendering  \n- Gradient material for velocity-based color  \n\n---\n\n## 🧪 Features\n\n- Realistic spring–mass motion with damping and gravity  \n- Procedural 3D coil visualization  \n- Velocity-based color feedback  \n- Easily configurable spring parameters  \n\n---\n\n## 🧭 License\n\nMIT License © 2025.  \nUse freely for educational, research, or simulation projects.\n\n---\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpietras333%2Fspring-mass-systems","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fpietras333%2Fspring-mass-systems","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fpietras333%2Fspring-mass-systems/lists"}