Many excerpted content
Translated by Aman JiangBox2d v2.0.1 User Manual
Chapter 4 debug drawing)
The implementation of b2debugdraw allows you to get a detailed picture of the physical world. Here is the available entity:
• Shape Contour
• Joint connectivity
• Core shape (for continuous collision)
• Broad-phase AABB, including the world's AABB
• Polygon Oriented Bounding Boxes (obbs)
• Broad-phase pairs (potential contacts)
• Centroid
This is the first way to draw these physical entities, which is better than accessing data directly. Because a lot of necessary information can only be accessed internally and changed from time to time.
Testbed uses debug drawing and contact listener to draw physical entities. It is a good example to demonstrate how to implement debug drawing and how to draw contact points.
Chapter 1 limitations)
Box2d uses some numerical approximation to make the simulation more efficient. This imposes some restrictions.
This is the current limit:
1. placing a heavy object on a relatively light object will be unstable. When the mass ratio is, the stability will decrease.
2. polygons may not slide smoothly over chains of edge shapes or other polygon shapes that are aligned. for this reason, tile-based environments may not have smooth collision with box-like characters. this problem will be fixed in the future.
3. link the body with a joint. If a lighter body hangs a heavier object, the body link may be stretched. For example, a very light chain hanging a heavy ball may be unstable. When the mass ratio exceeds, the stability will decrease.
4. There is usually a gap of about 5cm, And the collision between the shape and the shape is detected.
5. Continuous collision is handled in order. In the event of an impact, the body moves backward and stays there for the rest of the time. This may make the fast moving objects not smooth.
Chapter 1 References (references)
Erin catto GDC Tutorial: http://code.google.com/p/box2d/downloads/list
Collision Detection in interactive 3D environments, Gino van den Bergen, 2004
Real-time collision detection, faster ster Ericson, 2005