Book Image

Learning Game AI Programming with Lua

By : David Young
Book Image

Learning Game AI Programming with Lua

By: David Young

Overview of this book

Table of Contents (16 chapters)
Learning Game AI Programming with Lua
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Free Chapter
1
Getting Started with AI Sandbox
Index

Manipulating animations


A number of API calls allow you to manipulate the underlying animations backed by Ogre. While Ogre maintains the actual animation state, the sandbox is responsible for manipulating and updating these animation states.

Enabling and disabling animations

The enabling and disabling animations determine whether the animation will contribute to the skeleton's current pose. If multiple animations are enabled, they will combine in an additive manner to determine the skeleton's final pose.

Note

As none of our soldier's animations were authored to be played simultaneously with one another, additional steps are required to blend multiple animations together.

To determine if an animation is already enabled, we can use the Animation.IsEnabled function:

local enabled = Animation.IsEnabled(animation);
Animation.SetEnabled(animation, true);

Looping animations

Animation clips have an additional attribute, which is known as looping. Non-looping animations will freeze at their last keyframe...