https://github.com/adam-mazur/simple-physics-engine
A simple physics engine built with python and openCV implementing object collision.
https://github.com/adam-mazur/simple-physics-engine
collision-detection opencv-python physics-engine physics-simulation python3
Last synced: 3 months ago
JSON representation
A simple physics engine built with python and openCV implementing object collision.
- Host: GitHub
- URL: https://github.com/adam-mazur/simple-physics-engine
- Owner: Adam-Mazur
- License: mit
- Created: 2023-08-25T17:24:51.000Z (almost 2 years ago)
- Default Branch: main
- Last Pushed: 2023-08-25T17:29:29.000Z (almost 2 years ago)
- Last Synced: 2025-01-15T12:13:07.892Z (5 months ago)
- Topics: collision-detection, opencv-python, physics-engine, physics-simulation, python3
- Language: Python
- Homepage:
- Size: 62.5 KB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# Description
This is a simple physics engine built using the OpenCV library in Python. The engine simulates the collision between balls and walls, and it also adds a fun twist by animating the color of the balls upon collision.
# Usage
To run a simulation use the `run` function from the `engine.py` file. It takes a list of objects, which are instances of either `Ball` class or `Wall` class, the title, and some animation parameters like screen size etc.
```py
from engine import run
run(
objects,
"Animation1",
(height * unit_length, width * unit_length, 3),
10.0,
120,
unit_length,
)
```
You can create a scene using walls and populate it with moving objects to simulate real world motion.
# Examples
### Animation 1


### Animation 2

### Animation 3

