Game Development Reference
In-Depth Information
Figure 13-4 . Manually defining a shape in PhysicsEditor
Instead of creating the shape from a polygon, you could have also used the Add Rect-
angle button. (But then I wouldn't have been able to tell you how to add or delete ver-
tices and how to drag them.)
You can and should also set the collision bits for the plunger under the Fixture paramet-
ers section in the Parameters pane. The collision bits allow you to define which shapes
collide and which don't. You'll use the collision bit settings to prevent the plunger from
colliding with any shapes but the ball.
To make working with collision bits easier, you can change the names of collision bits.
The collision bit names aren't exported; they serve only to remind you what each bit's
used for. By default, the bits are called bit_0 to bit_15 . You'll want to change the
names of the first five bits to Ball , Bumper , Flipper , Plunger , and Wall , re-
spectively.
Box2D shapes collide with each other only when the category bit (the check box
column labeled Cat.) and the mask bit (the check box column labeled Mask) of both
shapes are set. Typically you'll want to assign each shape to just one particular cat-
egory. In the case of the plunger, make sure that only the category bit for the Plunger
 
Search Nedrilad ::




Custom Search