Physics Tutorial with 2D Engine & Source

Started by
4 comments, last by nire 18 years ago
Here's my physics tutorial from the GDC. It includes a 2D engine called "Box2D". Source code is included. The engine uses sequential impulses with some enhancements to enable stable stacking. http://www.gphysics.com/files/GDC2006_ErinCatto.zip Erin
Erinhttp://gphysics.com
Advertisement
Nicely done, great work. It's much simpler than other 2D tutorials, and the .ppt makes it much easier (as if it wasnt so simple already).

Thanks alot. :)
Thanks! I hope this will answer a lot of the questions people have about impulse methods.


Box2D Demo
Erinhttp://gphysics.com
the ppt was a bit cryptic but all in all nice stuff, i was thinking of adding joints to my program and here it is.
Pretty cool Erin.
Comments on code and slides:

1. Good examples showing how simple and good looking impulse-based physics can be.
2. Velocity/bias based interpenetration is simple to implement, though it does not allow high-rigidity: stacks are springy. I tried reducing k_allowedPenetration to minimize penetration/springy-ness; ran slowly, did not resolve issue. This is a technical comment; probably not an issue for a typical action game.
3. I'm curious to see a 3D implementation/demo (Danny Chapman's jiglib demo does a good job showing 3D impulses with friction+stacking). It would be interesting to see how your method(s) differ in behavior (I don't believe Danny used the same type of constraint system, for example).
4. There are still yet other ways to (realistically) implement rigid body physics ;-). This is one of the reasons I prefer the look of impulse-based physics vs. optimization-based physics: the resulting motion looks more realistic.
Airo:
Sorry, the slides were mostly designed for a live presentation. Hopefully looking at both the slides and code will clear things up. Yes, you can implement any type of joint with the method, but I did not go into full details on this.

John:
The main source of springiness is due to large mass ratios between the bomb and other boxes (up to 50-to-1). Sequential methods favor mass ratios close to one. You might try adjusting the bias factor to get a different look. I used a hard-coded value of 0.1f.


The important distinction of this method from other published methods is the use of accumulated impulses and accumulated clamping. Also, the use of Arbiters to store the accumulated impulses is crucial for performance and stability.
Erinhttp://gphysics.com

This topic is closed to new replies.

Advertisement