Final Project, Jenga physics simulation


by Nicolas Millasseau - 161L Winter 10

This Program was made with Xcode on Mac Os X 10.5.8 with Cocoa and OpenGL
It can be compiled by using any mac on leopard running Xcode 3


Description of the Project:

The goal of this project is to simulate the physics of the Jenga games when the tower is falling.

Details about the application:

1) UML Architecture

The application is divided into three main classes. The first one is WBLMainView class which set up the openGL environment and the inputs. The second one is WoodenBlock which represent a single Block and the third one is WBLDebugController which handle the debug GUI panel.


A block is represented by a position, and three angles of rotations. All of the block implements RK4 for calculate integration steps. Blocks are initially positioned into a 3 by 3 stack.
The direction of the simulation is parameterize into the main view class randomly (just with a certain angle). The blocks objects are "smart" they auto check themselves to see if there is any collision. If it's the case, the block will correct his trajectory alone. The DebugController class is here for testing purposes.

2) Ignition of the simulation

In the Jenga game the most important physics action is when the tower is falling. In order to simulate this behavior, the animation is ignited by pushing the tower.


Each elements will fall according to their velocity directions.

3) Crash

When a block is hitting the floor, the program has two options depending on the position of the block and of the contact point. It can bounce the block or swipe it. Or doing both of them.


The movement can be an interaction of both of these behavior because a block can bounce and then swipe on the floor.

4) References

I've used RK4 integrations for calculating the steps.

User Manual

1) The main view

The main view allow the user to rotate the scene by clicking and dragging the mouse. You can also zooming by using the scroll wheel


2) Debug Panel

To launch the animation simply click on the button in the low left corner. You can Do a step by step animation by pressing pause button and clicking on the right arrow several times. The light option allow you to turn on the light and the "Show cube" buttons load every cube of the scene into the table view. You can then showing or hiding cubes by clicking on the check box.


Video

LINK TO SOURCE CODE

Xcode code