I was the one originally (I think) interested in
that question
The code to load an .X file is quite simple:
Code: Select all
//Load the X file
IAnimatedMesh *pMesh = pSceneMng->getMesh("my_model.x");
if (pMesh == NULL)
{
//error
}
// Add the model to the scene
IAnimatedMeshSceneNode *pNode = pSceneMng->addAnimatedMeshSceneNode(pMesh,parent,id);
if (pNode == NULL)
{
//error
}
So you only have to keep both pointers to pMesh and pNode. You can use the same pMesh to create several identic actors (characters, objects, etc...) in your scene. When you enable an animation using the pMesh, all the actors related to that mesh show the same animation. Then you can use the pNode of each actor to displace them or some other actions.
The problem I had was that I only kept the pointer to the SceneNodes, and I asked for a way to obtain the pointer to the Mesh
Anyway, you can animate your X models without the IAnimatedMesh, using the setFrameLoop and setAnimationSpeed methods of the IAnimatedMeshSceneNode class.