Details

    • dca1e79eb1210c56ab1e922350eac8f6c39d7f02

    Description

      Child camera results in wrong combined world transforms (rotates into opposite direction or something like that).

      Now, looking at updateworldtransformjob.cpp we have:

      void updateWorldTransformAndBounds(Qt3DRender::Render::Entity *node, const QMatrix4x4 &parentTransform)
      {
          QMatrix4x4 worldTransform(parentTransform);
          Transform *nodeTransform = node->renderComponent<Transform>();
      
          if (nodeTransform != nullptr && nodeTransform->isEnabled())
              worldTransform = worldTransform * nodeTransform->transformMatrix();
      
          *(node->worldTransform()) = worldTransform;
      
          const auto children = node->children();
          for (Qt3DRender::Render::Entity *child : children)
              updateWorldTransformAndBounds(child, worldTransform);
      }
      

      The transform in this case is merely the following (from qcamera_p.h):

          void updateViewMatrix()
          {
              QMatrix4x4 m;
              m.lookAt(m_position, m_viewCenter, m_upVector);
              m_transform->setMatrix(m);
          }
      

      All in all just multiplying with worldTransform seems to be wrong for a lookAt type of camera.

      At first glance what it should be doing instead is decomposing the worldTransform and apply translate/rotate to the camera like QCamera::translateWorld() and rotate() would. (the decomposed translation and rotation is readily available in nodeTransform in fact) This is also how the camera controllers in extras work. Assuming that the camera's view matrix can be treated like an ordinary transform matrix when it comes to translate/rotate/scale is wrong.

      Not sure how this could be plumbed though since this is all on the backend side, with no access to the QCamera.

      Attachments

        Issue Links

          No reviews matched the request. Check your Options in the drop-down menu of this sections header.

          Activity

            People

              janichol Andy Nichols
              lagocs Laszlo Agocs
              Votes:
              0 Vote for this issue
              Watchers:
              1 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes