Important: Please read the Qt Code of Conduct - https://forum.qt.io/topic/113070/qt-code-of-conduct
How to rotate a 3D shape?
Hello dev community!, I'm new in Qt and I'm glad to part of this community.
I've been investigating how to rotate a basic shape from their origin axis by using the mouse drag event.
I've been studying the Qt documentation and found for the mouse events the following methods:
void QGraphicsItem::mouseMoveEvent(QGraphicsSceneMouseEvent * event) void QGraphicsItem::mousePressEvent(QGraphicsSceneMouseEvent * event)
On the other hand, I also these methods for rotating the shapes:
void QGraphicsItem::setTransformOriginPoint(const QPointF & origin)
I've been trying to rotate a basic cuboidmesh unsuccessfully.
Thanks and grettings!
I don't follow, the graphics view framework deals with 2D images, how does a mesh factor into it?
You're right kshegunov, it seems that 'QGraphicsItem' api is more focused on 2D rendering scenes.
At the moment I used a 'QOrbitCameraController' type to get an orbital rotation from the shape around the scene:
Qt3DExtras::QOrbitCameraController *orbitCamController = new Qt3DExtras::QOrbitCameraController(rootEntity); orbitCamController->setCamera(cameraEntity);
I'll investigating to try get the right rotation.
At the moment I used a 'QOrbitCameraController'
This is a different module entirely. Take a look at Qt3DCore::QTransform for a transformation component (you attach it to your entity exactly as you do for
I'm going to check out right now!!
Thanks for helping!!