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