O'Reilly logo

Unity 3 Game Development HOTSHOT by Jate Wittayabundit

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Creating a rockslide and trigger area

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.

Prepare for Lift Off

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, ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required