Boundaries
If there is no boundary, the physics engine will not constrain the nodes in the scene. In the previous example, the pink ball will drop forever because there is no physics boundary.
To add a boundary, add an edge loop physics body to the scene. The edge loop physics body is a rectangle whose interior acts as a boundary for the physics engine. Nodes with physics bodies are constrained by the edge loop.
The example adds an edge loop physics body to the scene. The pink ball no longer falls off the scene!
Tunneling
If a node moves too fast, it might pass through the edge loop. This is called tunneling. To prevent tunneling, edge loops have a default thickness of 50
. If you still find that a fast-moving node penetrates the edge loop, increase the thickness
property of the edge loop. The thickness is applied to the outside of the edge loop, and thus it will not affect the interior boundary size.
- If we show the physics body outlines, we see that the edge loop is simply a collection of non-dynamic (static) rectangles. You could have assembled this boundary by placing four non-dynamic rectangles, but the edge loop is a convenient shortcut. Note: The rectangle outlines appear as lines instead of full rectangles because portions of the rectangles are beyond the visible scene.