An Impulse Engine in Rust and WebAssembly

This is a simple 2D physics engine that simulates rigid body dynamics using impulse-based methods. It is written in Rust and compiled to WebAssembly.

I wrote this project a long time ago. As a Rust newbie, I tried to implement everything from scratch for learning purposes. That means it doesn’t depend on any third-party collision detection library or linear algebra library.

If your browser supports WebAssembly, you should see an interactive canvas below. Try to click your mouse and stack objects! The source code can be found here.

You may notice that objects will jitter when stacking. Maybe someday I can find a solution.

Reference

  1. Separating Axis Theorem with Details
  2. Separating Axis Theorem with Interactive Examples
  3. Making a 2D Physics Engine Series
  4. Game Technologies Series
  5. Find Contact Points Using Clipping
  6. Collision Response