Qt3D point and line picking?



  • Hi there, I've been trying to do point and line picking on a mesh in Qt3D. Here's a working version of triangle picking,

    auto renderSettings = new Qt3DRender::QRenderSettings(root);
    renderSettings->pickingSettings()->setPickMethod(Qt3DRender::QPickingSettings::TrianglePicking);
    
    auto entity = new Qt3DCore::QEntity(root);
    auto picker = new Qt3DRender::QObjectPicker;
    auto sphere = new Qt3DExtras::QSphereGeometry;
    entity->addComponent(picker);
    entity->addComponent(sphere);
    
    connect(picker, &Qt3DRender::QObjectPicker::clicked, [](Qt3DRender::QPickEvent* e) {
        auto p = dynamic_cast<Qt3DRender::QPickTriangleEvent*>(e);
        auto idx = p->triangleIndex();
    });
    

    However, when I switched to point picking or line picking, the clicked event is never triggered. Any idea how to make this work? Thanks in advance.


  • Banned

    This post is deleted!

Log in to reply
 

Looks like your connection to Qt Forum was lost, please wait while we try to reconnect.