Game Development Reference
In-Depth Information
7.2 T RANSFORMATION H IERARCHIES
Transformationhierarchies areawaytoorganizeandmanipulate datasuchthatbychanging
one part of the hierarchy, any dependent parts will be transformed accordingly, a familiar
exampleofatransformationhierarchyisseenwhenanimatinggamecharactersusingskelet-
on hierarchies. A root bone exists somewhere within a model, and one or many child bones
are attached to it, creating parent/child relationships, as a parent bone's position or rotations
changes, so do its children.
Thesameconceptcanbebroughttouserinterfaces,wecancreatetransformationhierarchies
that bind user interface elements to “bones” in the way animation systems do, and then we
can achieve control movement of many UI elements, respective to each other by moving or
animating a single transformation in the hierarchy.
Figure 81 - Transformation hierarchy, the rotation of the parent node in the center rotates the child elements sorrounding it.
The concepts apply to both 2D and 3D user interfaces, in 2D, an object may be the parent of
other objects, causing them to move, rotate, and even scale in relation to their parent.
One interesting application ofa hierarchical animation system is to create a 3D radial menu,
it is a good system to illustrate the idea of creating transformation hierarchies for user inter-
faces elements without too much complexity.
We will create an object called menu_3d, this will be the class that will hold the main func-
tionality forthemenu,itwillhandleuserinputandwithit,controltheanimation parameters
ofthe menu. Itwill also contain the hierarchy ofobjects, which wewill define asaninternal
Search WWH ::




Custom Search