Graphics Reference
In-Depth Information
obstacle is found on the left, the AIState changes to turn right. If obstacles are found to
be on both sides, the AIState will change to backing_up_looking_for_target. The AI
will back up until it no longer detects any obstacles.
2. chasing_target
The AI will turn to face the target and move forward toward it. If the target falls
out of range, the AIState returns to moving_looking_for_target.
3. backing_up_looking_for_target
In this state, the AI moves backward until no obstacles are found by its for-
ward raycasting. When no obstacles are found, the AIState switches randomly
to either stopped_turning_left or stopped_turning_right. This is randomized to
help reduce situations where backing up and turning in a particular direction
are unsuccessful in getting the AI away from an obstacle. Repeated backing up
and turning should eventually free the AI. As it does this, the code still checks
to see whether its target is within range (and if it is, the AIState will change to
chasing _target).
4. stopped_turning_left
The AI will turn to its left until no obstacles are found by the forward raycasts.
Although this state means that the AI is not moving, the code checks to see
whether its target is within range (and if it is, the AIState will change to chasing_
target instead).
5. stopped_turning_right
The AI will turn to its right until no obstacles are found. If its target is within
range, the AIState will change to chasing_target.
6. paused_looking_for_target
The AI does not move in this state but continues to check to see whether the target
is within range to chase.
7. translate_along_waypoint_path
Waypoints (managed by an instance of the Waypoints_Controller.cs script com-
ponent, discussed in Chapter 7) are used as targets to aim for. Transform.Translate
isĀ used to move the AI around, and the BaseAIController.TurnTowardTarget() is
used to control rotation. The AI will move forward toward a waypoint and move
on to the next waypoint when it gets close to it.
8. steer_to_waypoint
This state is similar to the translate_along_waypoint_path except that it does not
use TurnTowardTarget() for steering. Instead, input values are calculated (in the
Search WWH ::




Custom Search