Rigid Body Simulation

By Cheng-Nan Hsieh and Chia-Ming Chang
CSCI 520 - Computer Animation & Simulation
December 12, 2006

1.0 Objective

 

             Simulation of rigid body dynamics has been a field of active research for quite some time. Our goal for this project was to create a realistic simulation of rigid body dynamics, which is billiard game. In this case, we have to simulate the collisions between balls and implement the physics engine for this game. In order to achieve this goal, we build the whole project based on the ideas and algorithm of  SIGGRAPH97’course note Unconstrained rigid body simulation by Baraff and Witkin and Constrained rigid body simulation by Baraff and Witkin. The whole project is based on the physics attributes we set, and these attributes are calculated in ODE solver in this system. Further, the system provides interactive simulations with user input.

 

          There are still many potential applications in rigid body simulation. In different fields, such as movie or game, people still rely on rigid body simulation to create realistic scenes or interactive applications.

 

2.0 Implementation

        Our simulation of rigid body consists of three components. The first one is the whole physics system with physics attributes, which are mass, velocity, linear momentum, angular momentum, inertia tensor, force and torque. The second one is detection of contact collisions, which are ball, table plate, table boundaries, and table holes. Between each of them, we implement different functions to change their physics attributes. The third is rendering and visualization, which includes model construction and texture mapping.

 

2.1 Rigid body

∙ Introduction

           Because the billiard game is all about sphere shape, rigid body itself in this case is easy to define. Although the whole system is simple, we also implement the table boundary, score hole, and table. Also, we use quaternion to represent the rotation and other attributes. 

 

∙ Implementation

          We use Euler method for ODE solver to calculate position, quaternion, linear momentum, and angular momentum. Then, we use these to calculate the velocity and auxiliary variables such as inertia and omega (angular velocity). Further, we set one function to sum up the force and torque from other function or collision detection. And the friction part is implemented by comparing two points: one is fix point on the ground, and the other is the point on the surface. We use this relative velocity to determine the direction of friction force. 

 

2.2 collision detection

∙ Approach overview

           In order to achieve reasonable contact collision, we use the simplest method to determine whether two rigid bodies are closed enough. Then, we calculate the reaction between multiple objects.

∙ Implementation

          First, we use more than one time iteration to derive the minimum tolerance of the distance of two colliding objects. After that, we use conservation of momentum and geometric principle to determine the later value of momentum. We also implement a circle constraint and point constraint to simulate the effect of ball’s swirling around the hole.  

 

2.3 Visualization

∙ Introduction

          We use OpenGL for rendering the whole billiard game and fltk for dealing with windows and user input. 

           

∙ Implementation

          The whole billiard game model is created by gl and glu calls. Each object consist these attributes: position, scale, rotate, and texture. Using display list, we manage the drawing functions of models and reduce the redundancy of drawing codes. The texture part is implemented by loading image file from outside .bmp files and mapping to the right coordinate on the objects.  

 

3.0 Results

          As you can see in the graphs, we create a billiard game with ten plus one balls and a billiard table. User can adjust the direction and scalar of the input force to the start ball. Once starting to play the game with keyboard, every ball interacts with the table boundaries and other balls.

 

Here is the link for download our billiard game BilliardGame.rar

 

 

User input:

1. Shoot direction: number pad 4, 6, 2, 8: left right down up

2. Number pad : <Ctrl>+2, 8 change hit point to the Q-ball   “+” increase power

3. Direction pad: ← ↑ → ↓ change Q-ball position, if combine with
<Ctrl>+ ← ↑ → ↓, increase the moving step.

4. q: hit.  r: reset Q-ball.  <Shift>+ r : reset Q-ball and camera.

    c:  switch the camera mode: free or follow Q-ball

 

 

 

 

4.0 References

 

An Introduction to Physically Based Modeling:

Rigid Body Simulation I—Unconstrained Rigid Body Dynamics

Rigid body simulation II – non penetration Constraints

David Baraff  Robotics Institute  Carnegie Mellon University

 

 

           

 

The University of Southern California does not screen or control the content on this website and thus does not guarantee the accuracy, integrity, or quality of such content. All content on this website is provided by and is the sole responsibility of the person from which such content originated, and such content does not necessarily reflect the opinions of the University administration or the Board of Trustees