Model & separate motion data

If you are a new Irrlicht Engine user, and have a newbie-question, this is the forum for you. You may also post general programming questions here.
Post Reply
mikeem
Posts: 7
Joined: Wed May 01, 2013 5:37 pm
Location: A country called Germany

Model & separate motion data

Post by mikeem »

Hello everybody. As i understand it, you create models in 3DSMax and include their movement/motion data inside this model. Then in Irrlicht, you can chose from any of the included animations in that model-file. So, when you have 2 models which have the same motion (jumping), they still each must have their own jumping-motion included in their own model file. Isnt there already a way to separate the motion-data from the model-data? I imagine this: you have 1000 different models (which all have a humanoid skeleton), but only one motion-data file. inside irrlicht, you can then make all those different models jump anyways, beacause you apply that one motiondata file to their skeletons on the fly. isnt that already possible with irrlicht?

thanks for answeers, bye bye.
Otaka
Posts: 17
Joined: Fri Nov 16, 2012 1:47 pm

Re: Model & separate motion data

Post by Otaka »

It seems it is possible.
In my test project I have created many model with bones(biped) and applied skin modificator and without animation.
After that I created one biped that has the same bone structure as in the models. Then I made walk animation in biped and exported all models in X format.

In irrlicht I loaded all models and biped, and write following code:

Code: Select all

ISkinnedMesh*modelMesh=dynamic_cast<ISkinnedMesh*>(model->getMesh());
if(modelMesh==NULL){
    Utils::errorLog(L"Mesh is not ISkinnedMesh. Cannot make \"useAnimationFrom\"");
    return false;
}
modelMesh->useAnimationFrom(bipedMesh);
 
And after that:

Code: Select all

 
biped->setVisible(false);
 
After that my models have animation from biped.
I did not tested this way very much, but it seems, that model's skeleton and biped's skeleton should have equal size, in other way all animations will be messed.
And I am wonder, can I remove bipedMesh after animation copy. :? or "useAnimationFrom" creates just reference to animation data inside bipedMesh...?
mikeem
Posts: 7
Joined: Wed May 01, 2013 5:37 pm
Location: A country called Germany

Re: Model & separate motion data

Post by mikeem »

Hello Otaka, I totally forgot to say thanks for your reply. Bye bye!
Otaka
Posts: 17
Joined: Fri Nov 16, 2012 1:47 pm

Re: Model & separate motion data

Post by Otaka »

And notice for some one,who is very inattentive as I am!
You should check, if Irrlicht library compiled with enabled RTTI. Without RTTI operator "dynamic_cast" stops to work, and you will spend time to understand why.
Post Reply