Skip to content

gresm/nova-physics-python-fixed

Repository files navigation

Nova Physics is a lightweight and easy to use 2D physics engine.

This is re-packaged Nova Physics Python bindings, with custom patches.

Install with:

pip install git+https://github.com/gresm/nova-physics-python-fixed.git

The package will be installed under nova-physics namespace, but to import it in python use import nova. Uninstalling is simple as pip uninstall nova-physics.

As of currently, this will build Nova Physics library from source - support for pre-building it is not yet available. By default, this uses a stable release of Nova Physics, if you want a nightly version, run:

BUILD_NIGHTLY=1 pip install git+https://github.com/gresm/nova-physics-python-fixed.git

Example usage:

import nova

# Create the space
space = nova.Space()

# Create a body with box shape
body = nova.RigidBody(
    nova.RigidBodyType.DYNAMIC, # Type of the body
    nova.Vector2(0, 0)          # Initial position of the body
)

# Add rectangle to the body.
body.add_shape(nova.Shape.rect(5, 5))

# Add body to the space
space.add_rigidbody(body)

# Main loop
while True:
    # Advance the simulation with the timestep of 60 times a second.
    space.step(1 / 60)

About

No description, website, or topics provided.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages