Article Preview
Buy Now
COLUMN
Path and Character Animation
Combine Both Libraries
Issue: 3.2 (November/December 2004)
Author: Joe Nastasi
Author Bio: Joe Nastasi is the president of Pyramid Design, a software development firm and the developers of A-OK! The Wings of Mercury and FTP Suite.
Article Description: No description available.
Article Length (in bytes): 7,709
Starting Page Number: 38
Article Number: 3218
Related Link(s): None
Excerpt of article text...
In the last eight issues, we've created two basic libraries that handle both pose and path animation. In this issue, we'll tie things up by demonstrating how to use the libraries together to create automated 3D models for your application. But first, we'll discuss an improvement to the PathAnimationClass Update method.
PathAnimationClass.Update
The state machine that we originally implemented was created using the Select statement to decide which state to execute. This is a good method if the Update method was being called as fast as possible, but it is being called at a fixed interval by a timer. When executing a path containing integrated turns (where the turning and moving are happening at the same time), there was a delay every time it was time to execute the Turn state.
Now the Update method uses an If-Then statement to test for each state. In the case of integrated turns, the code for the Turn state executes the NextState method which changes to the Move state. Control gets passed to the next If-Then statement which tests for the Move state. Since the next state is now Move, we start to execute the Move state logic in the same period, not the next one. This eliminates the delay.
Methodology
...End of Excerpt. Please purchase the magazine to read the full article.