Vysics Engine
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 & Todos
Physics parts
- Shapes:
- Circle
β - Rectangle
β - Convex Polygons
β - Any type of Polygons (decomposition in convex polygons)
π
- Circle
- Forces:
- Gravity
β - Drag
β - Linear / Angular dumping
π - Constraints
π - Joints
π
- Gravity
- Integrations:
- Verlet integration
β
- Verlet integration
- Collisions:
- Broad Phase:
- Brute method
β - Grid method
β π§ - R-Trees method
π (rbush for inspiration)
- Brute method
- Narrow phase:
- SAT
β - GJK
π
- SAT
- Resolution based on impulse
β π§ - Continuous detection
π (Physics for Game Programmers; Continuous Collision)
- Broad Phase:
More engine related parts
- Debug drawings (using Vancas)
π - Tests (using jest)
π (maybe neverπ ) - Integration with Vancas
π - Optimisation (not a priority)
π
Examples
The playground and more importantly its code are a good example on how to use the vysics engine.
More examples will come after
Documentation
W.I.P.
For the moment you may want to generate docs using TypeDoc.