Skip to content
/ triton Public

Triton is a Python library for doing rigid body dynamics in 2D.

License

Notifications You must be signed in to change notification settings

slode/triton

Repository files navigation

Triton

Triton is a library for creating small two dimensional contraptions made from rigid bodies, spring-damper links and duct tape.

The examples require pygame to be installed.

Usage

sphere = Sphere(
    mass = 10.0,
    radius = 10.0,
    pos = Vector2d(10.0, 10.0),
    vel = Vector2d(2.0, 2.0),
    damping = 0.99,
    elasticity = 0.97)

sphere.collides_with(other_sphere)
sphere.resolve_collision(other_sphere)

# Applies force to the center-of-mass
sphere.apply_force(sphere.pos, Vector2d(1.0, 1.0))
sphere.apply_force_to_com(Vector2d(1.0, 1.0))

# Updates the state of the object based on external forces and state
sphere.update(t, dt)

About

Triton is a Python library for doing rigid body dynamics in 2D.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages