 |
It's alive! Up until now we've been steering the vectoragent manually, using a "remote control" slider bar. Even though we've given the agent all of the internal mechanisms it needs to steer itself around, we've still had to "tell" the agent which direction to steer to.
To breathe life into the critter, all we had to do is program it to steer itself.
This exercise illustrates seek, the simplest of the basic steering behaviors. The seek behavior simply steers the agent towards a target coordinate.
Within the agent's code, the steering itself is done using the steering vector technique as described in the previous pages... But how is the steering vector itself determined?
The blue steering vector is calculated as the vector result of two vectors:
[1] The agent's forward vector (in red).
[2] A vector extending from the agent to the target itself.
As the agent turns towards the target, the steering vector becomes more and more acute until the agent is pointing straight towards the target.
The targets themselves are controlled by an external behavior clip. The agent is, for now, hard coded to determine the target position and to seek it, but as we begin to add a broader range of behaviors to the agent, such as flee, obstacle avoidance, and wander, we will need to program the agent to "choose" the most appropriate behavior based on what it can "see" in it's surroundings.
Download .FLA
The vectoragent will be going into the shop for a major overhaul. When you next see it it will have some pretty cool "brain" enhancements.
|