| |
|
|
||||
![]() |
||||||
| |
|
|||||
|
I
An Example Using Maya: Requirements and Design The example used in this article creates a group of flying fish that jump around in the ocean. Their direction and other traits are controlled procedurally by the user in real time using Maya. The fish themselves exhibit individual characteristics, such as tweaking their bodies while jumping, while still maintaining the unity of their group.
The following table shows an example of a few control parameters that are desired for the system:
The Tools Alias Wavefront's Maya is one of the most complete tools available, capable of providing users and developers with the power to do animation and game productions, from prototyping to the final delivery. The strength of Maya lies in its innovative workflow and user interface as well as its custom scripting capability. The scripting language MEL provides a good basement for users to quickly test out their ideas and methods. The ability to implement custom codes is a crucial flexibility, a fact that, unfortunately, many other software and tool vendors failed to see, instead electing to bury the flexibility deep in their program codes. In addition to MEL, Maya also provides a good API library that allows you to implement your system as a plug-in using C++ codes. A plug-in implementation runs at least several times faster than the MEL script implementation. Best of all, the API comes with standard Maya software, and does not cost the user an extra cent. Mathematics for the movement The main part of this system lies in the jumping motion of the fish. To recall, a typical trajectory path can be described using a simple mathematical equation: S = ut + ½ at2 where S is the displacement of the object u is the initial velocity of the object t is the time of flight and a is the acceleration, which in this case is the force of gravity. Assuming that the air resistance is negligible, this equation is appropriate to model the movement of the fish in the air, with S and u being vector quantities. Since MEL provides a complete set of vector functions, you will be able to implement this equation easily. Looking at the above trajectory function, however, you may realize that it could turn out to be quite complex and troublesome when you need to build in all the controls for the motion of the fish. What determines whether a function is useful or appropriate in modeling a system is not merely its accuracy in producing real-world results, but also the ease of implementation and its flexibility. In the entertainment production environment, realistic simulation is something that is great to have, but flexibility and extensibility of the functions always take precedence. An alternative to the trajectory functions is the very simple and versatile trigonometry functions, sine and cosine. Some of you may realize that sine and cosine functions are some of the easiest to use and most versatile building blocks of many wonderful algorithms. In this case, using the frequency, amplitude, and the phase components of the sine and cosine functions, along with some modification and appropriate changes in values, you are able to create variable control for the speed and height control of the animation. And with the help of some random functions and simple vector manipulation, a rather convincing and simple control system is created. The MEL codes shown in Listing 1 illustrate an example of the result that you could attain by expanding on the above discussion.
|
||||||||||||||||||||||||||||||||||
|
|