[Interest] QScreenRayCaster yields unexpected hits in Qt3DStudio's q3dsviewer

Marcel Kummer marcel at froglogic.com
Mon Sep 24 17:06:43 CEST 2018


G'day!

I've been playing around with QScreenRayCaster in different
environments. That worked fine with Scene3D in QML. I can obtain the
Qt3D scene root QEntity and programmatically insert a dummy entity that
has a QScreenRayCaster attached and cast away with it. The rays mostly
hit the mesh primitives I expected.

Now I'm trying to do the same in a Qt3D scene set up via the Qt3D Studio
runtime. I chose q3dsviewer as a small test application and attached my
event filter to the contained Q3DSWindow. It obtains the scene root from
Q3DSEngine, inserts a screen ray caster into the scene graph and casts
with it.

I open a dummy project that has a few mesh primitives visible in the
scene. But, oh noes! Regardless of where I cast my rays, I always just
get two hits:

Raycasting at QPoint(405,379) ...
Hit: 474 QVector(Qt3DRender::QLayer(0x7ffdcc8499c0, name = "Fullscreen
quad pass"), Qt3DExtras::QPlaneMesh(0x7ffdc25818f0),
Qt3DCore::QTransform(0x7ffdc25abf60), Qt3DRender::QMaterial(0x7ffdc257f1d0))
Hit: 438 QVector(Qt3DRender::QLayer(0x7ffdcaa3f970, name = "Compositor
quad pass"), Qt3DExtras::QPlaneMesh(0x7ffdc38e4f70),
Qt3DCore::QTransform(0x7ffdcaab8350), Qt3DRender::QMaterial(0x7ffdc38ce510))

Which looks like two plane meshes. Despite the picking settings being
set to AllPicks, my primitives never get picked. What am I doing wrong? :)

My changes to q3dsviewer and the event filter class are attached,
likewise the sample Qt3DS project with the primitives.

Greetings,
Marcel
-------------- next part --------------
A non-text attachment was scrubbed...
Name: raycaster_in_q3dsviewer.tgz
Type: application/x-gzip
Size: 3275 bytes
Desc: not available
URL: <http://lists.qt-project.org/pipermail/interest/attachments/20180924/650766eb/attachment.bin>


More information about the Interest mailing list