Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • Users
  • Groups
  • Search
  • Get Qt Extensions
  • Unsolved
Collapse
Brand Logo
  1. Home
  2. Qt Development
  3. General and Desktop
  4. QPickingSettings does not change the behaviour

QPickingSettings does not change the behaviour

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 171 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • H Offline
    H Offline
    huajian
    wrote on last edited by huajian
    #1
    Qt3DRender::QPickingSettings *settings = new Qt3DRender::QPickingSettings();
    settings->setPickMethod(Qt3DRender::QPickingSettings::PickMethod::TrianglePicking);
    

    Hello, I am using Qt3D to make 3D object pickable. But after I set the PickMethod as TrianglePicking, the behaviour still look like the default BoundingVolumePicking. Do I mistake something?

    For example, even if I click the centre empty space of torus, the torus will be picked. (change its colour from yellow to red). This behaves more like BoundingVolumePicking than TrianglePicking.
    Could anyone check? Thanks in advance!
    Screenshot 2020-07-20 at 22.59.31.png

    Also, I made a simple check. My PickingSetting does not take effect. Does anyone know why?

    QObject::connect(m_picker, &Qt3DRender::QObjectPicker::clicked, [torusMaterial](Qt3DRender::QPickEvent *pointer){
        if ( dynamic_cast<const Qt3DRender::QPickEvent*>( &(*( pointer ))) ){
            qInfo() << "is pickEvent";
            if ( dynamic_cast<const Qt3DRender::QPickTriangleEvent*>( &(*( pointer ))) ){
               qInfo() << "is TrianglePickEvent";
            } else qInfo() << "is not TrianglePickEvent";
        } else qInfo() << "not anything";
        torusMaterial->setDiffuse(QColor(255, 0, 0, 127));
        qInfo() << "clicked";
    });
    

    Above code gives me result "is pickEvent" "is not TrianglePickEvent" "clicked"

    1 Reply Last reply
    0

    • Login

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • Users
    • Groups
    • Search
    • Get Qt Extensions
    • Unsolved