Adding dynamic characters to virtual 3D scenes is the basic requirement for virtual community construction and 3D games. Before achieving this goal, it is necessary to analyze the characteristics of the role and describe their respective ways of implementation.
Character role features and implementation methods in virtual 3D scenarios:
1) Being able to truly reflect human actions in the real world, and be able to combine these different actions, such as walking and watching. This feature can be achieved through the skeleton animation, because this type of model is a skeleton structure composed of interconnected "Bones", which can be generated for the model by changing the orientation and position of the skeleton.
2. This feature can be achieved by combining physical model packages, such as ode and pal.
3) Create and import dynamic character models into the scene accurately. Models can be created using creator, 3 DMAX, Maya, and other modeling software. To import the created character model to a virtual scenario, you need to find the underlying similarities between the two types of models. Generally, the format of the texture file is similar, and find the common location of the geometric file, it is likely to be traced back to the numerical matrix or even the vertex pair position. For example, the main code for loading the character model file is:
For (unsigned int I = 0; I <mbodynode-> getnumchildren (); I ++)
{
OSG: matrixtransform * scale = dynamic_cast <OSG: matrixtransform *> (mbodynode-> getchild (I); // obtain the Matrix
For (unsigned Int J = 0; j <scale-> getnumchildren (); j ++)
{
OSG: geode * geode = dynamic_cast <OSG: geode *> (scale-> getchild (j); // get the child node
For (unsigned int K = 0; k <geode-> getnumdrawables (); k ++)
{// Obtain the basic element
OSG: drawable * drawable = dynamic_cast <OSG: drawable *> (geode-> getdrawable (k ));
}
}
}
..........
Return mbodynode. Get ();
4) The motion amplitude of the dynamic character model changes. You can set the position and size of the character model by setting the transformation matrix at the top of the entire model data organization. In addition to the corresponding changes in the movement of the skeleton animation, the changes in the running and other amplitude are also amplified by parameters such as the translation in the transformation matrix.
Figure: