Game Development Reference
In-Depth Information
There's moreā€¦
By linking this recipe together with Chapter 4 , Mastering Character Animations , we can
easily make Jaime play some animations while he's moving.
Start by adding the AnimationManagerControl class to the AI character using the
following code:
aiCharacter.addControl(new AnimationManagerControl());
We need to tell it to play animations. In AIControl , find the forward and backwards
brackets inside the controlUpdate method and add the following lines:
if (forward) {
...
spatial.getControl(AnimationManagerControl.class).setAnimation(AnimationManagerControl.Animation.Walk);
} else if (backward) {
...
spatial.getControl(AnimationManagerControl.class).setAnimation(AnimationManagerControl.Animation.Walk);
} else {
spatial.getControl(AnimationManagerControl.class).setAnimation(AnimationManagerControl.Animation.Idle);
}
Search WWH ::




Custom Search