Game Development Reference
In-Depth Information
We can see from the preceding diagram that if the distance between the enemy and the
waypoint position is smaller than the radius of the waypoint, it will trigger the waypoint to
change the next waypoint index, which will also change the movement direction of the en-
emy.
Next, we used the OnDrawGizmos() function to create the visual line link for each
Waypoint game objects to show in the editor. Waypoint is the empty game object, which
is sometimes difficult to edit in the editor because we cannot see it in the editors.
Tip
It is better to use gizmo than trying to use camera layers and meshes for the waypoint.
So, using gizmo is the best solution and the best way that Unity provides us to see the
visual of an empty game object. We also have the trigger parameter in the Inspector view
to turn the visual on or off and to tell our enemy to walk randomly or by the order of the
waypoint index.
Search WWH ::




Custom Search