Game Development Reference
In-Depth Information
By experimenting with the Tolerance setting, I found that a good compromise in this
case is a Tolerance value of 4,0. This creates a shape with 18 vertices, and it's the
highest Tolerance value that still traces the image's shape quite accurately. The default
Tolerance setting of 1,0 would have created a shape with 31 vertices, so I was able to
save 13 vertices. But you'll notice if you cycle through the Tolerance values that even a
Tolerance value of only 1,5 will already cut down the number of vertices to 20.
Tip You can use the Frame Mode setting in the Shape Tracer to create a shape
for an animation (sequence of images). To create an animation in PhysicsEditor,
you'll have to add more image files to a shape under Image Parameters in the
Parameters pane, in the default PhysicsEditor window. By clicking the + button
next to the Filename setting, you can add additional images to a single shape;
then you can have the shape trace create a shape that's either the intersection or
the union of each animation frame's shape.
When you're satisfied with the traced shape, click the OK button to close the Shape
Tracer dialog. This creates the new shape. You still have to perform a quick manual
tweak for the pinball table's collisions to work smoothly. Because the screen area
defines the collision on the sides of the pinball table, you should drag the lower left-
hand and lower right-hand corner vertices as well as the upper left-hand and upper
right-hand corner vertices slightly outside the screen area and downward and upward,
respectively, so that they're clearly outside the black frame border drawn around the
table-top image. See Figure 13-7 for a visual hint.
By extruding these two vertices, the shape will form a soft transition to the sides of the
screen borders. Without extruding them, the ball might get reflected from the tips of
these vertices because of the slight inaccuracies always present in physics simulations.
Now move the anchor point (the blue circle with the +) to the top left-hand corner,
preferably by using the anchor point settings in the Parameters pane under Image Para-
meters. Set the Relative values to 0,0 and 1,0, respectively, to move the anchor point to
the top left-hand corner. This anchor point position will later let you align the image
exactly with the screen border by simply positioning it to 0,480 in point coordinates.
Search Nedrilad ::

Custom Search