Game Development Reference

In-Depth Information

Figure 13-1
. The pinball table built in this chapter

Shapes: Convex and Counterclockwise

Let's start with the requirements of collision polygons. The first thing you need to be

aware of when defining collision polygons for Box2D and Chipmunk is that these en-

gines expect the collision polygons to have the following properties:

▪ Vertices defined in a counterclockwise fashion

▪ Polygons as convex shapes

A
convex
shape is a shape where you can draw a straight line between any two points

without the line ever leaving the shape. In
concave
shapes, you can draw a straight line

between two points such that the line is not entirely contained within the shape.
Figure

13-2
illustrates the difference between convex and concave shapes.