A 2D impulse based, rigid body physics engine for the web. The goal of this project is not to create a state of the art physics engine. The goal is to create an understandable code that people can read & used to better understand classic physics.
Based on:
- How Physics Engine Works - Build New Games
- Building a 2D Game Physics Engine
- How to Create a Custom 2D Physics Engine
- Video Game Physics Tutorial | Toptal
- And of course Wikipedia
✅: Implemented
🔧: Still needs some work
🔜: Not implemented but planned
- Shapes:
- Circle ✅
- Rectangle ✅
- Convex Polygons ✅
- Any type of Polygons (decomposition in convex polygons) 🔜
- Forces:
- Gravity ✅
- Drag ✅
- Linear / Angular dumping 🔜
- Constraints 🔜
- Joints 🔜
- Integrations:
- Verlet integration ✅
- Collisions:
- Broad Phase:
- Brute method ✅
- Grid method ✅ 🔧
- R-Trees method 🔜 (rbush for inspiration)
- Narrow phase:
- SAT ✅
- GJK 🔜
- Resolution based on impulse ✅ 🔧
- Continuous detection 🔜 (Physics for Game Programmers; Continuous Collision)
- Broad Phase:
- Debug drawings (using Vancas) 🔜
- Tests (using jest) 🔜 (maybe never 😞)
- Integration with Vancas 🔜
- Optimisation (not a priority) 🔜
The playground and more importantly its code are a good example on how to use the vysics engine.
More examples will come after 🔜...
W.I.P.
For the moment you may want to generate docs using TypeDoc.