title: Qt3d: rotate camera around the object (C++)
body: <p>I have a simple Qt3D example (attached below) and I'd like to be able to rotate the camera around the object - right now the object rotates around the camera. I've found some suggestions for other frameworks and am wondering what the best way is to do this in Qt3D?</p>
  
  <p>main.cpp</p>
  
  <pre><code>#include &lt;QApplication&gt;
  #include &lt;QWidget&gt;
  
  #include "Viewer3d.h"
  
  
  int main(int argc, char* argv[]) {
      QApplication app(argc, argv);
  
      auto* v3d = new Viewer3d(nullptr);
  
      v3d-&gt;setMinimumSize(800 * 2, 600 * 2);
      v3d-&gt;show();
  
      return app.exec();
  }
  </code></pre>
  
  <p>Viewer3d.h</p>
  
  <pre><code>#pragma once
  
  #include &lt;Qt3DCore/QEntity&gt;
  #include &lt;Qt3DCore/QTransform&gt;
  #include &lt;Qt3DCore/QAspectEngine&gt;
  
  #include &lt;Qt3DRender/qrenderaspect.h&gt;
  #include &lt;Qt3DRender/QCamera&gt;
  #include &lt;Qt3DRender/QMaterial&gt;
  #include &lt;Qt3DRender/QPointLight&gt;
  
  #include &lt;Qt3DExtras/Qt3DWindow&gt;
  #include &lt;Qt3DExtras/QTorusMesh&gt;
  #include &lt;Qt3DExtras/QCuboidMesh&gt;
  #include &lt;Qt3DExtras/QOrbitCameraController&gt;
  #include &lt;Qt3DExtras/QFirstPersonCameraController&gt;
  #include &lt;Qt3DExtras/QForwardRenderer&gt;
  #include &lt;Qt3DExtras/QPhongMaterial&gt;
  #include &lt;QtWidgets/QWidget&gt;
  #include &lt;QScreen&gt;
  
  class Viewer3d: public QWidget {
  public:
      explicit Viewer3d(QWidget* parent= nullptr);
  
  private:
      Qt3DCore::QEntity* m_rootEntity;
      Qt3DExtras::Qt3DWindow *m_view;
  
  };
  </code></pre>
  
  <p>Viewer3d.cpp</p>
  
  <pre><code>#include &lt;QHBoxLayout&gt;
  #include "Viewer3d.h"
  
  Viewer3d::Viewer3d(QWidget *parent): QWidget(parent) {
      m_view = new Qt3DExtras::Qt3DWindow();
      m_view-&gt;defaultFrameGraph()-&gt;setClearColor(QColor(QRgb(0x4d4d4f)));
  
      m_rootEntity = new Qt3DCore::QEntity;
  
      auto* torus = new Qt3DCore::QEntity(m_rootEntity);
  
      auto* mesh = new Qt3DExtras::QTorusMesh;
      mesh-&gt;setRadius(5);
      mesh-&gt;setMinorRadius(1);
      mesh-&gt;setRings(100);
      mesh-&gt;setSlices(20);
  
      auto* cube = new Qt3DCore::QEntity(m_rootEntity);
  
      auto cubeMesh = new Qt3DExtras::QCuboidMesh;
      cubeMesh-&gt;setXExtent(4);
      cubeMesh-&gt;setYExtent(4);
      cubeMesh-&gt;setZExtent(4);
  
      auto* transform = new Qt3DCore::QTransform;
      transform-&gt;setTranslation(QVector3D(0, 0, 0));
  //    transform-&gt;setRotation(QQuaternion::fromAxisAndAngle(QVector3D(1,0,0), 45.f ));
  
      Qt3DRender::QMaterial* material = new Qt3DExtras::QPhongMaterial(m_rootEntity);
  
      torus-&gt;addComponent(mesh);
      torus-&gt;addComponent(transform);
      torus-&gt;addComponent(material);
  
      cube-&gt;addComponent(cubeMesh);
      cube-&gt;addComponent(transform);
      cube-&gt;addComponent(material);
  
  
  
      // Camera
      Qt3DRender::QCamera *cameraEntity = m_view-&gt;camera();
  //    cameraEntity-&gt;lens()-&gt;setPerspectiveProjection(45.0f, 16.0f/9.0f, 0.1f, 1000.0f);
      cameraEntity-&gt;setPosition(QVector3D(0, 0, 40.0f));
  //    cameraEntity-&gt;setViewCenter(QVector3D(0, 0, 0));
  
  //    cameraEntity-&gt;setPosition(QVector3D(0, 0, 500.0f));
  //    cameraEntity-&gt;setUpVector(QVector3D(0, 1, 0));
  //    cameraEntity-&gt;setViewCenter(QVector3D(0, 0, 0));
  //    cameraEntity-&gt;transform()-&gt;setScale(1.f);
  
  
      // manipulator
      auto* manipulator = new Qt3DExtras::QOrbitCameraController (m_rootEntity);
      manipulator-&gt;setLinearSpeed(50.f);
      manipulator-&gt;setLookSpeed(180.f);
      manipulator-&gt;setCamera(cameraEntity);
  
      // light
      auto *lightEntity = new Qt3DCore::QEntity(m_rootEntity);
      auto *light = new Qt3DRender::QPointLight(lightEntity);
      light-&gt;setColor("white");
      light-&gt;setIntensity(1);
      lightEntity-&gt;addComponent(light);
      auto *lightTransform = new Qt3DCore::QTransform(lightEntity);
      lightTransform-&gt;setTranslation(cameraEntity-&gt;position());
      lightEntity-&gt;addComponent(lightTransform);
  
      // Set root object of the scene
      m_view-&gt;setRootEntity(m_rootEntity);
  
      QWidget *container = QWidget::createWindowContainer(m_view);
      QSize screenSize = m_view-&gt;screen()-&gt;size();
      container-&gt;setMinimumSize(QSize(200, 100));
      container-&gt;setMaximumSize(screenSize);
  
      auto *hLayout = new QHBoxLayout(this);
      hLayout-&gt;addWidget(container, 1);
  
      setLayout(hLayout);
  
  }
  </code></pre>
  
  <p>Is there a straightforward way to this in Qt3D?</p>