Uploaded image for project: 'Qt'
  1. Qt
  2. QTBUG-105024

QtQuick3D - problem with object picking when node with QtQuick 2D component is inside 3D view

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • P2: Important
    • None
    • 6.4.0 Beta2
    • Quick: 3D
    • None
    • (Qt for Python)
      Qt 6.4
      PySide 6.3.1
      Windows 10 64bit

      PC: Ryzen 5 4600H, GTX 1650Ti, 16GB DDR4
    • Windows
    • 2022 Qt Quick 3D: Week 49

    Description

      I would like to use 2D elements (i.e. Text or Rectangle) in a 3D view. Unfortunately, there is a problem with them. When the rotation of the Text matches the user's camera (rotation: userCamera.rotation), so that it is always visible to the user, object picking does not work, or only works in undefined camera positions. When I turn off the visibility of the Text, selecting objects works fine.

       

      EXAMPLE:

      Now I can't pick lines / points (change their color):

       

       

      When I turn off the visibility of the text, there is no problem with this:

       

       

      But for example, in this camera position and text turned ON, object selection also works:

       

       

      Code:

      Cube points:

      Repeater3D { 
          id: repPktCube 
          model: [[400, 0, 0], [500, 0, 0], [400, 100, 0], [500, 100, 0], [400, 0, 100], [500, 0, 100], [400, 100, 100], [500, 100, 100]] 
          Model { 
              id: modelPktCube  
              visible: cbPts.checked 
              source: "#Cube" 
              objectName: "Cube" 
              scale: Qt.vector3d(0.1, 0.1, 0.1) 
              position: Qt.vector3d(repPktCube.model[index][0], repPktCube.model[index][1], repPktCube.model[index][2]) 
              materials: DefaultMaterial { 
                  diffuseColor: modelPktCube.isPicked ? "violet" : "black" 
              } 
              pickable: true 
              property bool isPicked: false 
          } 
      }

      2D Text that rotates to user:

      Node {
          position: Qt.vector3d(200, 100, 0) 
          rotation: userCamera.rotation 
          Text { 
              text: 'Txt' 
              visible: cbTxt.checked 
          } 
      }

       
      Picking is copied from Picking example https://doc.qt.io/qt-6/qtquick3d-picking-example.html 

       

      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
              djdan7 Daniel Janos
              Votes:
              1 Vote for this issue
              Watchers:
              7 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved:

                Gerrit Reviews

                  There are no open Gerrit changes