Dice in Cup Physics Simulation

Physics Engine for Rigid Body Collision


I did the Dice in Cup project for the final assignment of Northwestern University’s Theory of Machines - Dynamics (MECH_ENG 314) course to simulate the dynamics of a 2-dimensional square dice bouncing inside a cup (or box) that is being shaken up by external forces under gravity. Through this project, I gained hands-on experience with doing symbolic calculations using Python's SymPy library and demonstrated my understanding of dynamic mechanical systems. Overall, Dice in Cup gave me the opportunity to capture abstract theories regarding physics and mechanics into a concrete deliverable.

Concepts Utilized:

  • Lagrangian dynamics to calculate the trajectory of the bodies when they are not actively impacting
  • Rigid body transformations to simulate realistic movements for the two objects as they move through the environment
  • Impact update calculations to determine the behavior of the dice after hitting the cup wall

  • Check out my GitHub repository for a detailed explanation of the code and the video demo