I Hate Quaternions – Enemy Waypoint Patrol and Chase Script

Below is a link to a snippet of code I built this morning. Putting this code onto a GameObject will cycle through an array of waypoints and smoothly walk towards each one after the other until the current waypoint variable is larger than the length of the array, at which point it will reset the current waypoint back to value 0 of the array. If the boolean isAlert is true, it will chase a the Player. This script will also smoothly Slerp the rotation to face the object it is moving towards (using Quaternions).

Check the script HERE.

facebooktwittergoogle_plusredditpinterestlinkedinmail