Game Development Reference
In-Depth Information
This is how we set up navigation targets for hiding spots.
Next, we need to have the AI choose a point to take cover. Lastly, we need to select
and move to a hiding spot. To organize the tree better, add a
selector
node above
the hiding
constraint
node. Then, add another
constraint
node below the
selector
node and create a custom action node with a new
ChooseHidingSpot
class.
The tree should look like the following screenshot:
Note
When creating larger trees, giving the nodes descriptive names helps keep the
tree organized and easy to understand.
The following is the code for our action to choose a hiding spot: