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.
π Try it online
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.