ModelInstance* TestApp::CreateNewInstance (ModelTemplate* temp, const String& modelName, const String& instanceName) { // Create a new model using the template Model* model = mCore->GetModel(modelName); model->SetSource(temp); // Create a new instance of the model above ModelInstance* inst = mCore->GetRoot()->AddObject<ModelInstance>(instanceName); inst->SetModel(model); inst->AddScript<OSPlayIdleAnimations>(); return inst; }