Java Reference
In-Depth Information
Teeter Totter Example
The previous example used a StaticBody to “hang” a ball from a fixed point. In this example we will use a
StaticBody to fix a rectangular Body in place to make a sort of Teeter Totter or lever.
Figure 6-6. Teeter Totter
Figure 6-6 shows the scene, where the triangle at the bottom is the static body, holding the center of
the long rectangle in place as two balls fall on the rectangle and make it move like a Teeter Totter. In this
example the balls are randomly created, so this example is a little different than the other examples
because every time it runs, something different happens. This demonstrates how a good physics engine
can simplify life for the developer, since the animations simply work, regardless of the particulars in the
scene.
Search WWH ::




Custom Search