Im using combinned meshes on my game, example: armor its one model, and head its another. Than, I combine the both, and set just one animation for both.
I would like to know if I doing this in correct and better way:
Node* modelNode = scene_->CreateChild("Pike");
modelNode->SetPosition(Vector3(Random(40.0f) - 20.0f, 0.0f, Random(40.0f) - 20.0f));
modelNode->SetRotation(Quaternion(0.0f, Random(360.0f), 0.0f));
auto* modelArmor = modelNode->CreateComponent<AnimatedModel>();
modelArmor->SetModel(cache->GetResource<Model>("Models/Pike/model.mdl"));
modelArmor->SetMaterial(cache->GetResource<Material>("Models/Pike/Materials/mat1.xml"));
modelArmor->SetCastShadows(true);
auto* modelHead = modelNode->CreateComponent<AnimatedModel>();
modelHead->SetModel( cache->GetResource<Model>( "Models/Pike/head.mdl" ) );
modelHead->SetMaterial( cache->GetResource<Material>( "Models/Pike/Materials/mat1.xml" ) );
modelHead->SetCastShadows( true );
auto * animationController = modelNode->CreateComponent<AnimationController>();
animationController->PlayExclusive( "Models/Pike/anim.ani", 0, true, 0.0f );
Im asking this, because all characters will works this way, and need to know if Im using the better way on on performance issues (I dont want to drop so much the FPS).
Thanks!