https://github.com/Habrador/Ten-Minute-Physics-Unity
Implementations in Unity of the Ten Minute Physics YouTube channel. Instead of using Unity's built-in physics engine, you will learn how to make your own. This is useful if you want to simulate ropes, cloth, tires, etc. You will also learn how to make fluid simulations and soft body physics.
https://github.com/Habrador/Ten-Minute-Physics-Unity
cloth-simulation computer-science csharp double-pendulum eulerian-fluid-simulation fluid-simulation n-body pendulum physics physics-simulation rigidbody simulation soft-body soft-body-simulation softbody-simulation spatial-partitioning triple-pendulum unity unity3d xpbd
Last synced: 20 days ago
JSON representation
Implementations in Unity of the Ten Minute Physics YouTube channel. Instead of using Unity's built-in physics engine, you will learn how to make your own. This is useful if you want to simulate ropes, cloth, tires, etc. You will also learn how to make fluid simulations and soft body physics.
- Host: GitHub
- URL: https://github.com/Habrador/Ten-Minute-Physics-Unity
- Owner: Habrador
- License: mit
- Created: 2022-05-20T05:52:24.000Z (almost 3 years ago)
- Default Branch: main
- Last Pushed: 2025-03-20T16:08:35.000Z (about 2 months ago)
- Last Synced: 2025-04-13T04:05:04.526Z (about 1 month ago)
- Topics: cloth-simulation, computer-science, csharp, double-pendulum, eulerian-fluid-simulation, fluid-simulation, n-body, pendulum, physics, physics-simulation, rigidbody, simulation, soft-body, soft-body-simulation, softbody-simulation, spatial-partitioning, triple-pendulum, unity, unity3d, xpbd
- Language: C#
- Homepage:
- Size: 3.93 MB
- Stars: 284
- Watchers: 9
- Forks: 31
- Open Issues: 2
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Ten Minute Physics in Unity
Implementations in Unity of the YouTube channel [Ten Minute Physics](https://matthias-research.github.io/pages/tenMinutePhysics/). My contribution is that I have translated the code from mainly JavaScript to C#, and I have commented the code to make it easier to understand what's going on. I have also fixed a few minor bugs and improved the performance.
## 1-2. Cannon ball
Simulate a bouncy cannon ball.
## 3. Billiard
Simulate billiard balls with different size and mass. Watch this YouTube video for examples:
[](https://www.youtube.com/watch?v=ErsK2osLkQU)
## 4. Pinball
Simulate a pinball game.
## 5. Beads on wire
Simulate beads attached to a circular wire.
## 6. Pendulums
Simulate the chaotic behavior of pendulums with as many arms as you want and where each arm can have different mass. With many arms you get a rope or hair! Watch these YouTube videos for examples:
[](https://www.youtube.com/watch?v=GqGHz6gtakY)
[](https://www.youtube.com/watch?v=jMDiP7mhEx0)
## 7. 3d Vector Math for Simulation
Nothing to simulate
## 8. Interaction
Catch and throw a ball with your mouse.
## 9. Getting ready to simulate the world with XPBD
Nothing to simulate
## 10. Soft body physics
Simple unbreakable soft body bunny physics. You can flatten it and throw it around with your mouse.
## 11. Find overlaps among objects
Find overlaps among thousands of objects blazing fast. Implements a version of the [Spatial Partitioning design pattern](https://github.com/Habrador/Unity-Programming-Patterns) called "Spatial Hashing" which is really useful if you have an unbounded grid.
## 12. Optimized soft body physics (TODO)
Is not optimizing the code from #11, but is showing how you can use a more detailed mesh and make that faster. You use two meshes: one with fewer triangles that is tetrahedralized, and one with more triangles, and then they interract during the simulation.
## 13. Tetrahedralizer (TODO)
Implemetation of an algorithm that splits a mesh into tetrahedrons. Will be available here when finished: [Open source Computational Geometry library](https://github.com/Habrador/Computational-geometry)
## 14. Cloth simulation
Basic cloth simulation.
## 15. Cloth self-collisions
TODO
## 16. Simulation on the GPU
TODO
## 17. Eulerian Fluid Simulator with 200 lines of code
Spoiler: It's just the simulation part that's 200 lines of code. You need a few more lines of code to set it up, display it on screen, etc. Watch this YouTube video for examples:
[](https://www.youtube.com/watch?v=6Jw1CsTOkDg)
## 18. FLIP Water Simulator
TODO
## 19. Differential equations and calculus from scratch
Nothing to simulate
## 20. Height-field water simulationSimulate a swimming pool with balls.
## 21. Fire simulator
TODO
## 22. Basic rigid body simulator
Simulating rigid bodies using XPBD.
## 23. Sweep and Prune collision detection
A fast way to check collisions between many objects by checking each object's Axis-Aligned Bounding Box (AABB). Is related to "11. Find overlaps among objects" but can handle objects with different sizes.
## 24. Bounding Volume Hierarchies
TODO
# Bonus
Bonus implementations related to the code above.
## 3-Body Problem
Simulation of planetary orbits based on this famous unsolved problem (https://en.wikipedia.org/wiki/Three-body_problem). Watch this YouTube video for examples:
[](https://www.youtube.com/watch?v=o5HWPeP-JS4)
## Calculate pi
Calculate decimals in pi by bouncing boxes with different mass and calculate collisions. If the small box is 1 kg and the big box is 10000 kg, then the small box will collide with the big box and the wall to the left 314 times. Inspired by 3Blue1Bown's YouTube video: [The most unexpected answer to a counting puzzle](https://www.youtube.com/watch?v=HEfHFsfGXjs).