Well, we did not take much effort to load a static model, rather we took more effort to animate the model. Hence, let's first understand how animation data is encoded in a JSON file.
Open model/obj/mrgreen.json
in your text editor. In the file, you will find an element animation. When the file is viewed in any JSON viewer, you will see name
, fps
, length
, and hierarchy
as the animation object's child elements. To understand our JSON file, we used an online viewer (http://jsonviewer.stack.hu/). We loaded our JSON file in the viewer as shown in the following screenshot:
The other child elements are obvious but the most interesting element is hierarchy
. The hierarchy
element is an array; the length of this array is equal to the length of bones. Each array element has animation data for the corresponding bone index. The hierarchy
array element holds the keyframes (keys
) element, which holds DOF (position
, rotation
, and scale
) values for that...