Hello guys,
I am experiencing the use of the StaticModelGroup class. My goal is to create and display several gates from one unique model file called “Models/Gate.mdl”.
Here is the code snippet I use :
Node *gatesGroupNode = mScene->CreateChild("GatesGroup");
StaticModelGroup *group = gatesGroupNode->CreateComponent<StaticModelGroup>();
group->SetModel(mResourcesCache->GetResource<Model>("Models/Gate.mdl"));
for(int index = 0; index < 20; index++)
{
LOGINFO("Creating gate node n°" + String(index));
Node *gateNode = mScene->CreateChild("Gate");
gateNode->SetPosition(Vector3(index * 10, 0, index * 10));
group->AddInstanceNode(gateNode);
}
When I execute that code, I see no gates displayed while in my debug window, I see the message:
“Creating gate node n°0”
…
If I set the number of gates to create to 1 in the for loop, meaning that I only create one single gate, it works fine. I see the unique gate displayed in my view port.
The code seems to be quite correct and it works for one gate. But it does not work for more that one (2, 3, and more).
I am turning around and for the moment, I cannot figure out what is wrong with my code. Or maybe I forgot something ?
I am very interested if you might have some ideas that can help me solve that issue.
For information, my code is inspired from the sample HugeObjectCount provided in Urho3D engine. Such example works fine, but not mine and I do not really see the differences between both programs.
Thanks a lot in advance for your answers.
Regards.