Variants of bridge-building games have been around for a long time. The classical Bridge Builder is a 2D physics game where the player is required connect beams to create a bridge strong enough for a train (or some other moving object) to pass.
This recipe will describe most of the core functionalities needed to create such a game, including making the objects stay 2D and not wander off on the z axis.
We'll have some basic controls for the game:
The following figure shows a bridge:
Before we begin with more physics-related functions, ...