A 2D Rigid Body Physics Engine.
Project description
PyPhy2D
Description
PyPhy2D is a 2D Rigid Body Physics Engine designed to simulate physical interactions of objects in a two-dimensional space. It is easy to integrate and can be used for games, simulations, and educational purposes.
License
This project is licensed under the MIT License.
Installation
Before installing PyPhy2D, ensure you have pygame or pygame-ce installed:
pip install pygame
or
pip install pygame-ce
Example Project
from pyphy import World, Body, Vector2
import pygame
import sys
WIDTH, HEIGHT = 900, 900
WINDOW = pygame.display.set_mode((WIDTH, HEIGHT))
space = World(window=WINDOW, gravity=(0, 9.8))
clock = pygame.time.Clock()
FPS = 60
testBody = Body.CreateCircleBody(radius=25, center=Vector2(100, 100), density=1.2, restitution=0.8, static=False)
space.AddBody(testBody)
while True:
dt = clock.tick(FPS) / 1000
space.step(dt)
WINDOW.fill((0, 0, 0))
space.Render()
pygame.display.update()
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit()
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file pyphy2d-1.tar.gz.
File metadata
- Download URL: pyphy2d-1.tar.gz
- Upload date:
- Size: 11.0 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
7ddc68b4bcc81df25e9024e88546ea9cdea49f350f89deeaf526ba4579e3dc2e
|
|
| MD5 |
69f06bcfad501d13dff738ab3ff20702
|
|
| BLAKE2b-256 |
9c45e782fbd9a8894350df11833132749085632232f9cdeddc871b32b5b7ea3c
|
File details
Details for the file pyphy2D-1-py3-none-any.whl.
File metadata
- Download URL: pyphy2D-1-py3-none-any.whl
- Upload date:
- Size: 12.8 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.0 CPython/3.12.4
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
f9c15b7eae56ea7930f286e4f79143a25014e27a133e17e524e0b9902e2744d7
|
|
| MD5 |
27d5cf468670df9ffaf4c3526500b1c7
|
|
| BLAKE2b-256 |
e79e27106f6970efc5d58d811ca99fbb05e7d5358ccc22e2c99c50fd24d85fe3
|