Game Development Reference
In-Depth Information
Note
If you need more details on how to set up a scene with a character patrolling a
Now that we have a scene, let's create a behavior tree for Penelope; we want her
to just walk following the path and stopping at the end. Select Penelope's AI object
and open
Behavior Editor
. Create a new behavior tree called
WalkPenelope
and
add a patrol route node to the root. Set the route to
"PenelopeRoute"
. We just want
Penelope to walk the route once and then stop, so set the
Repeat
field to
Never
and the
Loop Type
field to
One Way
. Lastly, set the
Move Target Variable
field to
moveTarget
and create a child
move
node that uses
moveTarget
to move. The tree
should look like the following screenshot:
If you run the demo now, Penelope will travel around the path, but there will be no
character animation; she will just slide on the ground. To fix this, we'll add animation
to our character.
Configuring RAIN animations
To configure animation for Penelope on her RAIN menu, select the
Animation
tab.
(Again, this is the tab with a little figure running on it.) RAIN supports two animation
systems:
BasicAnimator
and
MecanimAnimator
. Since the Penelope character
doesn't use Mecanim, leave the animator as basic. The
Add Animation State
drop-
down will then be automatically populated with the different animation clips available.
Choose the animation states
run
and
idle
.
Your animation tab should look like the following screenshot: