Gamasutra: The Art & Business of Making Gamesspacer
Collision Response: Bouncy, Trouncy, Fun
View All     RSS
June 28, 2017
arrowPress Releases
June 28, 2017
Games Press
View All     RSS






If you enjoy reading this site, you might also want to check out these UBM Tech sites:


 
Collision Response: Bouncy, Trouncy, Fun

February 8, 2000 Article Start Previous Page 3 of 3
 

Building with Sticks

Now that I have this nifty particle simulator where I can attach particles with springs and apply forces to them, it’s time to build something. Let me start with a simple block such as the one in Figure 3.Each of the edges of the object is a spring connecting the vertices. Unfortunately, if I run this object through the simulator, I end up with a big heaping mess. The mess occurs because the springs connecting the vertices aren’t enough to provide stability for the cube. In order to create a cube that won’t collapse, it’s necessary to put crossbeam supports on each face of the cube as in figure 4.

Creating objects this way feels more likeconstructing a bridge than 3D modeling. You find yourself adding struts and crossbeams all over the place. Leave a face open and it behaves correctly. The face without the crossbeam supports is more likely to collapse.

Bring Me Stability or Bring My Program Death

I mentioned before that by using a simple Euler integrator, I’m sacrificing numerical stability for ease and speed of calculation. You may wonder, however, what happens when the system becomes unstable. There’s a really easy way to find out what will happen. Remember the spring coefficient that was applied to the particles? This coefficient represented the stiffness of the springs used. If I set that value fairly high because I want really stiff springs, the little Euler integrator cannot handle it. If you run that cube I had with stiff springs, you may see something like Figure 5 or something equally interesting. The still frame doesn’t do it justice. This is a rigid body way out of control.

Figure 3.
A simple dynamic cube.

Figure 4. A stable cube.

Figure 5. A cube out of control

There’s a solution to combat this instability beyond, "Don’t do that" — it’s to give my integrator an upgrade. Euler’s method is simply not sophisticated enough to handle problems such as this.

Kid in a Gummi Bear Store

I really find in fun to play with this simulator. It’s very satisfying to bring in shapes and play with making them stable and tweaking the spring and gravity settings. You then can fling the objects all around and bounce them off the walls. There are many more variables that can be added to the simulator. Other forces such as contact friction can be added. Some interactive features such as pinning vertices would make it more fun. But I think we’re on our way to a really fantastic Jello-land simulator. Check out the source code and demo application on the Game Developer web site. It will allow you to load in your own shapes, connect them with springs, and play around with the simulator.

For Further Info:

• Baraff, David, and Andrew Witkin. "Physically Based Modeling," SIGGRAPH Course Notes, July, 1998, pp. B1-C12. I built my first particle dynamics simulator after seeing an article by David Barraff a couple of years ago. For this article, I used one source of his and Andrew Witkin’s in particular.

• Hecker, Chris. "Behind the Screen." Game Developer, October 1996 – June 1997. Credit for the ideas and some of the methods of simulation go to Chris Hecker. I have tried to base my code on many of his ideas so it will be familiar to readers. His excellent series of articles on rigid body physics got me and many others excited about real-time physics. Hopefully, I can continue to build on this tradition. Also available on Chris’s web site at http://www.d6.com/users/checker.

You will need several good math and physics books if you really want to get into this topic. Here are a few that I used in this article.

• Beer and Johnston. Vector Mechanics for Engineers: Dynamics, Sixth Edition, WCB/McGraw-Hill, New York, 1997.

• Mullges and Uhlig. Numerical Algorithms with C, Springer-Verlag, New York, 1996

• Acton, Forman S. Numerical Methods that Work, Harper and Row, New York, 1970. This last book was a useful little book my father had from his days of working on guidance systems. Now I am using it to make virtual-jello. Go figure.

• Doug DeCarlo at the University of Pennsylvania wrote an application for X-Windows called XSpringies that allows you to simulate 2D particle-spring interactions. You can check this out from his website at http://www.cis.upenn.edu/~dmd/doug.html or get the program at ftp://cis.upenn.edu/pub/dmd/xspringies/xspringies-1.12.tar.Z.

Many have told Jeff that his top is made of the rubber and bottom of the spring. Bounce him and Darwin 3D a note at jeffl@darwin3d.com.


Article Start Previous Page 3 of 3

Related Jobs

Insomniac Games
Insomniac Games — Durham, North Carolina, United States
[06.27.17]

Mid to Sr Gameplay Programmer
Telltale Games
Telltale Games — San Rafael, California, United States
[06.27.17]

Tools Engineer
Insomniac Games
Insomniac Games — Burbank, California, United States
[06.27.17]

Senior Gameplay Programmer
Insomniac Games
Insomniac Games — Burbank, California, United States
[06.27.17]

Engine Programmer





Loading Comments

loader image