On Thu, Mar 18, 2021 at 5:22 AM Walter Rawdanik <w...@warmi.net> wrote: > > You can’t convert 2d coordinates to a 3d position because you are missing the > z coordinate.
I can have a dummy z value as 1 for the calculation. The problem is similar as described here https://community.khronos.org/t/getting-2d-to-3d/20050/6 in opengl they could fetch the requirted matrix for gluUnProject and get the 3d coordinates from 2d. However, in Qt3d, I'm stuck to fetch the required matrix i.e modelView etc and pass it correctly to the vector3d::uproject and get the corresponding 3d points back. All I could do is the following, however I doubt the correctness of it. // The code is exactly same as wireframe example file TrefoilKnot.qml Transform { id: trefoilMeshTransform translation:Qt.vector3d(Qt.vector2D(100, 100)).unproject( modelView ,mainCam.projectionMatrix, forwardRenderer.viewportRect) property real theta: 0.0 property real phi:0.0 property real roll: 0.0 rotation: fromEulerAngles(theta, phi, roll) scale: root.scale } In translation, Qt.vector2D(100, 100) is where I give the x,y (window coordinates) and expect the unproject api will return the 3d points for translation. mainCam.projectionMatrix and forwardRenderer.viewportRect are set from BasicCamera and Forwardrenderer from main.qml respectively. And I do not know where to get modelView. If you let me know the modelView matrix and confirm the above changes are right, I'll be thankful. Do let me know. _______________________________________________ Interest mailing list Interest@qt-project.org https://lists.qt-project.org/listinfo/interest