#physics-2d #physics-engine #rigid #physics #2d #rigid-body #gamedev

appl

Appl is a physics engine powered by the Rapier library. It is currently 2d only.

5 releases

0.2.2 Sep 24, 2021
0.2.1 Sep 24, 2021
0.2.0 Sep 24, 2021
0.1.1 Sep 24, 2021
0.1.0 Sep 24, 2021

#452 in Simulation

MIT license

12KB
188 lines

Appl

version downloads license

Description

Appl Logo Appl is a library that provides abstraction over the Rapier library.
Appl was created due to the lack of any physics engine for beginners to use.
Appl's main purpose is to be simple and easy to use.

Example

use appl::*;

fn main() {
  // Initialize Appl World
  let mut appl = ApplWorld::new(Vect2 { x: 0.0, y: 9.81 }, 50.0);
  // Create ground rigid body
  let ground = appl.add_rigid_body(
    BodyType::Static,
    0.3,
    BodyShape::Cuboid {
      width: 64.0,
      height: 32.0,
    },
    0.3,
    Vect2 { x: 0.0, y: 320.0 }
  );
  // Create box1 rigid body
  let box1 = appl.add_rigid_body(
    BodyType::Dynamic,
    0.3,
    BodyShape::Cuboid {
      width: 32.0,
      height: 32.0,
    },
    0.3,
    Vect2 { x: 0.0, y: 0.0 }
  );

  for _ in 0..200 {
    // Update the world
    appl.step();

    // Prints box1 position
    let box1_pos = appl.get_rigid_body_pos(box1);
    println("{}, {}", box1_pos.x, box1_pos.y);
  }
}

How to contribute

Any pull request are definitely welcomed and appreciated!

If you have any issues or questions, please open an issue and i will try to help you.

Project Status

This project is in it's very very early stage and currently only works for 2d.

License

MIT

Dependencies

~8MB
~164K SLoC