Getting ready

We will need to create three base classes that are the data types to be used by the high-level classes and algorithms. The Location class is very similar to the Steering class and is used to define a target position and rotation given the formation's anchor point and rotation. The SlogAssignment class is a data type to match a list's indices and agents. Finally, the Character class is a component to hold the target Location class.

The following is the code for the Location class:

using UnityEngine; using System.Collections; public class Location { public Vector3 position; public Quaternion rotation; public Location () { position = Vector3.zero; rotation = Quaternion.identity; } public Location(Vector3 position, Quaternion rotation) ...

Get Unity 2018 Artificial Intelligence Cookbook - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.