Solved Transformation of QExtrudedTextMesh
-
Hi all,
I have a qt3d scene rendered in my code and I'm looking for a way to make a label as QExtrudedTextMesh to be rotated following the view angle of the user so as it is always parallel to the screen view.
I guess I have to link in some way the camera view angle with the label's transformation but I can't think anything.
I hope I have explained the issue as much clearly as I could.
Thank you in advance for any help.
-
It's solved. For anyone interested below is my solution.
void SceneModifier::addLabel(int label, float x, float y, float z) { QString s = QString::number(label); // Set label's text // auto *text = new Qt3DCore::QEntity(m_rootEntity); text = new Qt3DCore::QEntity(); text->setParent(m_rootEntity); auto *textMaterial = new Qt3DExtras::QPhongMaterial(m_rootEntity); textMaterial->setDiffuse(QColor(0,100,0)); auto *textTransform = new Qt3DCore::QTransform(); textTransform->setTranslation(QVector3D(x, y, z)); textTransform->setScale(2.5f); textMesh = new Qt3DExtras::QExtrudedTextMesh(); textMesh->setText(s); textMesh->setDepth(.01f); text->addComponent(textMaterial); text->addComponent(textMesh); text->addComponent(textTransform); }