Q: Qt - [c++] replacing material on a QEntity
Solved
Game Development
-
Hello Forum!
How can i remove a QMaterial* component from a QEntity the safe way?
given the sequence:// create the objects (of course with suitable arguments) auto* entity = new Qt3DCore::QEntity(_root); auto* mesh = new Qt3DExtras::QCuboidMesh; auto* scaleTransform = new Qt3DCore::QTransform; auto* material = new Qt3DExtras::QPhongMaterial; auto* anotherScaleTransform = new Qt3DCore::QTransform; // assign unordered entity->addComponent(mesh), entity->addComponent(scaleTransform); entity->addComponent(material); entity->addComponent(anotherScaleTransform); // what i want: entity->removeComponent(material); entity->addComponent(anotherMaterial);
best regards, kevin
-
Hello Forum!
How can i remove a QMaterial* component from a QEntity the safe way?
given the sequence:// create the objects (of course with suitable arguments) auto* entity = new Qt3DCore::QEntity(_root); auto* mesh = new Qt3DExtras::QCuboidMesh; auto* scaleTransform = new Qt3DCore::QTransform; auto* material = new Qt3DExtras::QPhongMaterial; auto* anotherScaleTransform = new Qt3DCore::QTransform; // assign unordered entity->addComponent(mesh), entity->addComponent(scaleTransform); entity->addComponent(material); entity->addComponent(anotherScaleTransform); // what i want: entity->removeComponent(material); entity->addComponent(anotherMaterial);
best regards, kevin
@kevin_d said in Q: Qt - [c++] replacing material on a QEntity:
How can i remove a QMaterial* component from a QEntity the safe way?
This is the correct way.
-