C++ Qt3DExtras::QTorusMesh – cannot be rotated in Z direction
JulianM last edited by JulianM
It could be me, but I tried to make very quickly Rotation Gizmo in C++ Qt3D – and I noticed that there is a problem with QTorusMesh – rotation in Z.
I thought is something wrong in my fast code – but even when I tried Torus in basic shapes demo – also doesn’t work. Here is an example code
// Torus shape data //!  m_torus = new Qt3DExtras::QTorusMesh(); m_torus->setRadius(1.0f); m_torus->setMinorRadius(0.4f); m_torus->setRings(100); m_torus->setSlices(20); //!  // TorusMesh Transform //!  Qt3DCore::QTransform *torusTransform = new Qt3DCore::QTransform(); torusTransform->setScale(2.0f); torusTransform->setRotation(QQuaternion::fromAxisAndAngle(QVector3D(0.0f, 1.0f, 0.0f), 90.0f)); torusTransform->setRotationZ(45.0f); torusTransform->setTranslation(QVector3D(5.0f, 4.0f, 0.0f));
I added only ….. torusTransform->setRotationZ(45.0f);
I expected this to be rotated in 90 around Y and then 45 around Z.
So the result should be something like that / I cannot upload picture here/
- - - - in fact is only 90 deg - - -
You should also add what version of Qt you are using.
And the platform as well.
Sorry about that.
I'm using 5.12 on Windows 10.
My concern is that this looks like there is a problem in Qt3DCore::QTransform which is core module from a long time / 5.5 or earlier/.
I was away of Qt for the last few years but before I love it - was solid as rock - now ... there are obvious small bugs even in the demos.
Documentation is close to nothing ... really sad.
BTW Just to update for information - i made custom entity Circle and attached to it - Qt3DCore::QTransform and I got the same result - does't work - that's why I got suspicious in QTransform . I looked in the the code - some eigen vector comprising is "fishy" - but i went in another direction - using directly Matrices and now works- but then QTransform looks useless - and nobody to not catch it till now- means nobody use it? Probably because of the priority of QML.
JohanSolo last edited by
Might it be your 45° rotation is performed around the torus symmetry axis?
torus symmetry axis
I don't think so.
As I mentioned I made rotation Gizmo as 3D modeling software for rotation - so I have 3 "donuts" - one facing X; one facing Y and one facing Z;
For this one that is facing Z - it will be clear that even rotation to happen it will not be visible for the viewer in Z direction.
That is probably your point if I can get you correctly.
Anyway my problem were the other two / facing X and Y/ when i rotate them in Z - QTransform attached to this Entity report rotationZ - number but there is not rotation of the particular torus.
Any rotation of a torus in Z refuse to happen.
Ok I found what is causing that - the torus is created facing Z.