I am using a QObjectPicker to select a 3D mesh on a Qt3DWindow. I am getting "clicked" signals when I click near the object but not actually on it, and this is an issue. I believe that if I change the QPickingSettings::PickMethod to TrianglePicking instead of the default setting of BoundingVolumePicking, it will fix this issue. Is this a reasonable assumption? The PickMethod settings are handled in the QPickingSettings class while object selection is handled in the QObjectPicker class. How do I attach the desired settings in the QPickingSettings class to the QObjectPicker class? I am using Qt5. Any help would be greatly appreciated, I am completely stuck!
Qt3DRender::QObjectPicker *MeshGraphics::createObjectPicker()
{
Qt3DRender::QObjectPicker *picker = new Qt3DRender::QObjectPicker();
Qt3DRender::QPickingSettings *settings = new Qt3DRender::QPickingSettings(picker);
settings->setFaceOrientationPickingMode(Qt3DRender::QPickingSettings::FrontFace);
settings->setPickMethod(Qt3DRender::QPickingSettings::TrianglePicking);
settings->setPickResultMode(Qt3DRender::QPickingSettings::NearestPick);
QObject::connect(picker,
SIGNAL(clicked
(Qt3DRender
::QPickEvent*)),
this,
SLOT(pickMesh
(Qt3DRender
::QPickEvent*)));
return picker;
}
Qt3DRender::QObjectPicker *MeshGraphics::createObjectPicker()
{
Qt3DRender::QObjectPicker *picker = new Qt3DRender::QObjectPicker();
Qt3DRender::QPickingSettings *settings = new Qt3DRender::QPickingSettings(picker);
settings->setFaceOrientationPickingMode(Qt3DRender::QPickingSettings::FrontFace);
settings->setPickMethod(Qt3DRender::QPickingSettings::TrianglePicking);
settings->setPickResultMode(Qt3DRender::QPickingSettings::NearestPick);
QObject::connect(picker, SIGNAL(clicked(Qt3DRender::QPickEvent*)), this, SLOT(pickMesh(Qt3DRender::QPickEvent*)));
return picker;
}
To copy to clipboard, switch view to plain text mode
Bookmarks