Now that we can create agents, we're going to take a step back and look at what properties are available to an agent and what they mean.
Whenever you need to return the orientation of an agent, it's easiest to use the forward vector that usually represents the direction of movement of an agent. Both the left and up vectors of orientation are available as well. Whenever you need to change an agent's direction, simply set its forward vector.
To access and set the forward vector of our agents, we can use the built-in GetForward
and SetForward
helper functions.
local forwardVector = agent:GetForward(); Agent.SetForward(agent, forwardVector);