In the first section, we will create the
WaypointsContainer script to place the waypoint for our AI movement direction, which can be edited in the editor.
First, we will create the
Waypoint script and use the
Gizmos object to draw an image icon (
Gizmos.DrawIcon()) and the wire sphere (
Gizmos.DrawWireSphere()) by putting it in
OnDrawGizmos(). Both functions are used to draw the image icon and the radius of waypoint, which is used to display the position of waypoint and the radius that the character should start turning to the next waypoint.
Then, we will create
WaypointsContainer that will contain all necessary functions to get the direction of the current waypoint to the next one. ...