Using sprite placeholders to create a simple physics scene
Unity offers physics for 2D scenes by providing Colliders, Rigidbodies, gravity, and so on, just as it does for 3D scenes. In this recipe, we’ll create a 2D mountain-style landscape made up of some colored triangles, and then have some square blocks fall down due to gravity into one of the low dips where two triangles overlap. Rather than using images for our sprites, we’ll learn how to use 2D geometric sprite placeholders, a feature in Unity allowing for quick prototyping and scene layouts, where the placeholder sprites can easily be replaced with texture images later. The following screenshot illustrates the starting and ending locations of the square blocks as they fall down and collide with the triangular landscape sprites:
Figure 8.51: A physics scene where 2D squares fall into a dip in the landscape
Getting ready
We’ll create everything from scratch in Unity for this recipe, so no...