Game Development Reference
In-Depth Information
Engage thrusters
Now, we have set the
Destructible
tag and created an empty game object,
Wall
. Next, we
will create the four cubes to represent each piece of the broken wall:
1. Go to
GameObject
|
Create Other
|
Cube
, name it
Cube1
, and drag it to the
Wall
game object, which we just created, as shown in the following screenshot:
2. Add the
Rigidbody
component to
Cube1
to make the wall fall realistically when it
breaks by navigating to
Component
|
Physics
|
Rigidbody
and adding
Rigidbody
.
3. Next, we will go to the cube's
Inspector
view to set up the parameters as follows:
Transform
Position
X
:
3
,
Y
:
3
, and
Z
:
0
Rotation
X
:
0
,
Y
:
0
, and
Z
:
0
Scale
X
:
6
,
Y
:
6
, and
Z
:
1
Box Collider
Rock
(drag the
Rock
physics material from the
Resources/Physics Materials
folder to the
Project
view)
Material
Mesh Renderer
Materials
Size
1
Element 0
Rock
(drag the
Rock
material from the
Resources/Materials
folder to the
Project
view)
Rigidbody