This repository includes the source code for a 2D physics engine implemented in JavaScript, entirely from scratch without reliance on any external physics libraries. The engine is capable of simulating ball collisions, gravitation and other things, adhering to real-world physical laws such as the law of conservation of energy.
- More than a hundred ball collisions in real time.
-
Ability to simulate multiple objects with varying mass and velocity
-
The engine provides control over the friction and gravity of each individual object.
- Creating walls and curves.
- Can copy objects, ball and walls.
- Realistic simulation of gravitation and object's attraction.
- Perfectly circular orbit around any object.
- Integration of springs in order to constraints movements.
- Allow to zoom out and zoom in, and move the camera with right click.
- Clone this repository
- Serve the index.html file through a server service, such as express,flask or by utilizing the built-in server feature in Visual Studio Code.
To showcase the capabilities of the physics engine, here is some examples:
- Contré Yavin : Creator of the project.