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. QObjectPicker with overlapping objects

QObjectPicker with overlapping objects

Scheduled Pinned Locked Moved Unsolved General and Desktop
1 Posts 1 Posters 178 Views
  • 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.
  • G Offline
    G Offline
    giusirux
    wrote on last edited by
    #1

    Hi everyone,
    I tried to use QObjectPicker to picking my STL file which is loaded thanks to QMesh.
    I can click, move, rotate these objects, but the problem is that, when I overlap more objects, small objects is englobed in the bounding sphere of a large object behind it, so I lose them. As documention says:
    "By default, for performance reasons, ray casting will use bounding volume picking. [...] Triangle picking will produce exact results but is computationally more expensive."
    So, my code is:

    m_component = new Qt3DCore::QEntity(root);
    m_component->addComponent(meshComponent);
    m_component->addComponent(componentMaterial);
    m_component->addComponent(componentTransform);
    
    Qt3DRender::QObjectPicker *picker = new Qt3DRender::QObjectPicker(m_component);
    picker->setDragEnabled(true);
    Qt3DRender::QPickingSettings *setting = new Qt3DRender::QPickingSettings(picker);
    setting->setFaceOrientationPickingMode(Qt3DRender::QPickingSettings::FrontAndBackFace);
    setting->setPickResultMode(Qt3DRender::QPickingSettings::NearestPick);
    setting->setPickMethod(Qt3DRender::QPickingSettings::TrianglePicking);
    setting->setWorldSpaceTolerance(0.5f);
    m_component->addComponent(picker);
    

    As you can see it, I use the setting (QPickingSettings::TrianglePicking), but when I click not far away the object, it also can be picked (this problem is similar to https://forum.qt.io/topic/85297/how-could-i-improve-the-qobjectpicker-accuracy but there aren't answers for him)
    Any suggestions?

    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