Physics Simulation

Completed: 8 December, 2022

In this project, I simulated the physics for a Dice in a Box as my final project for my Machine Dynamics class. In it, I calculated the collisions between the dice and the box, as well as the forces keeping the box up and rotating.

To begin, I defined transformation frames for each corner of the dice and each side of the box. This was used to calculate the collisions between the two when there was an impact. I then calculated the dynamics of the dice and box, using their kinetic and potential energies to write Lagrangians. With these Lagrangians, I calculated their Euler-Lagrange equations. With this, I was able to simulate the behaviour of the dice and the box falling in gravity. I next added in two forces, a force on the y of the box to counteract gravity, and a force on the angle of the box, to spin it. Finally, I wrote in the possible collisions of the dice and the box. As you can see in the video, when the dice and the box collide, we can see a fully elastic impact happen.

For more details on the entire project, please checkout my GitHub repository