In the last section we created the destructible wall object, which contains four cubes, each with the Rigidbody and Box Collider attached to it, and we can shoot to break it.
In this last section, we will create the rockslide that the rock will fall on when the player hits the trigger area and creates the Rocks
and TriggerArea
script to enable and disable the Rockslide
object.
Go to GameObject | Create Empty to create the empty game object and name it Rockslide
and reset its position to X: 0, Y: 0, Z: 0.
Then, create another empty game object by going to GameObject | Create Empty; name it Break
and drag it inside the Rockslide
, as shown in the following screenshot:
Next, create two cube objects, which will be the static object to make it look like some part of the rock is still stuck to the terrain, and the trigger area to make the rock fall down when the player hits it. Before we start, we need to reset the Transform of the Break
game...