Game Development Reference
In-Depth Information
Now, we are done with the
Waypoints
script. Go back to Unity editor to create the waypoint
game object by going to
GameObject
|
Create Empty
to create the empty game object
and name it
Waypoints
. Then, drag the
Waypoints
script (that we just created) to this
Waypoints
game object, and set its
Transform
|
Position
to
X: 0
,
Y: 0
,
Z: 0
,
Rotation
X:0
,
Y:
0
,
Z: 0
,
Scale
X: 1
,
Y: 1
,
Z: 1
, or we can click on the litle gear in the
Inspector
view and choose
Reset
to reset all to the default posiions, as shown in the following screenshot:
You will see something similar to the following screenshot:
Right now, we have the irst or start posiion of the waypoint. We need more waypoint
posiions, which is very easy to achieve. You just need to create a new empty game object again
and drag
Waypoints
inside. Go to
GameObject
|
Create Empty
to create the empty game
object and name it
Waypoint
. Then, we drag the object to
Waypoints
, which we already
have in the scene, and set its transform posiion to
X: 5.2
,
Y: 0
,
Z: 4.3
. We can also create more
waypoints by pressing
Crtl + D
(in Windows) or
Command + D
(on a Mac) to duplicate another
four
Waypoint
game object, and set all these objects' transform posiions as follows:
F
Position
X: 7.2
Y: 0
Z: 10.2
F
Position
X: 3.4
Y: 0
Z: 12.1